I'd like to make a Leaflet map based on GeoJSON (not TileLayer) data, and have it switch between different GeoJSONs based on the zoom level. For example, switching from a state to county GeoJSON, or switching from a highly-simplified GeoJSON to a high resolution GeoJSON.
I see from this question a How to set different zoom levels in layers in a map using leaflet that it can be done using the minZoom and maxZoom options when creating a TileLayer. However, these properties aren't available for a GeoJSON feature group. Is there a natural way to change maps based on zoom level when using GeoJSON?
You can put a listener on map zoomend, removing one geojson (e.g. countries) and adding another one (e.g. counties) to the map.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With