Style Switcher Control
Allow users to toggle between different basemap styles.
Last updated
Allow users to toggle between different basemap styles.
Last updated
If you are using a Maplibre or Mapbox map, you can set up the Style Switcher control. This adds an area on the map with a list of styles that you choose that users can toggle between. See an example here.
To set this up, go to Controls when creating your map. Make sure you are not using a Google Map, and turn on the Style Control. Then, enter in each Style URL or Custom JSON in the left-side textbox, and titles on the right-hand side. Each entry should be on a different line so that the plugin can associate the correct style with the correct title.
If you are using a Custom JSON, make sure to use a tool like https://www.textfixer.com/tools/remove-line-breaks.php to remove all line breaks from your JSON before pasting it in. A couple examples of this are shown below!