Back to all examples
Reset state when changing style
Switch styles, and choose whether the SDK module state comes along (resetState)
A route, its waypoints, place pins, filtered POIs and incidents share one map. Switch style with the box ticked and they go; leave it clear and they stay drawn, taking on the new style’s look.
setStyletakes{ resetState }as its second argument: false and the modules carry their layers and data onto the new style, true and they start clean.RoutingModule.showRoutes,showWaypointsandPlacesModule.showare each given their service response once, never again across style switches.- The
filtershanded toPOIsModule.getandTrafficIncidentsModule.getcome along too, so the new style is filtered the same way.
Related examples
Map Chat Agent
Interactive map assistant using AI to control maps and services
AI
Places and Search
Map Style
Base Map
Geometry
Traffic
Routing
Web
Playground
Plugins
Map Chat Agent State Playground
Interactive map assistant using AI to control maps and services
AI
Places and Search
Map Style
Base Map
Geometry
Traffic
Routing
Web
Playground
Plugins
Site Selection Agent
A site selection agent on the TomTom Maps SDK Agent Toolkit: hand-picked default tools, custom analysis tools, its own persona and state slice
AI
Places and Search
Routing
Traffic
Map Style
Base Map
Web
Playground
Live Traffic Agent
AI traffic-manager assistant: monitor incidents, cluster hotspots, and analyse network state
AI
Places and Search
Map Style
Base Map
Geometry
Traffic
Routing
Web
Playground