You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a few collections that use the Geo Map type, and right now I'm editing the geoMap.json file to set the default view for the map so it's zoomed in on a particular town or country, but it'd be nice if the map could be set to auto-zoom so instead of showing the entire world by default, it'd show just where there are markers. A visual example would explain this better (I'll use Google Maps so I don't have to mess with my data):
Right now when I add a Geo Map collection, it shows the whole world:
But instead I'd like it to zoom in far enough so it encapsulates all the markers:
It sounds like this can be done in Leaflet if all the points are added to a FeatureGroup, then the bounds obtained with getBounds(), then fitBounds method method called to zoom in.
I'd give it a shot myself, but I'm still reading over the code to get a feel for how all of this fits together.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I've got a few collections that use the Geo Map type, and right now I'm editing the
geoMap.jsonfile to set the default view for the map so it's zoomed in on a particular town or country, but it'd be nice if the map could be set to auto-zoom so instead of showing the entire world by default, it'd show just where there are markers. A visual example would explain this better (I'll use Google Maps so I don't have to mess with my data):Right now when I add a Geo Map collection, it shows the whole world:
But instead I'd like it to zoom in far enough so it encapsulates all the markers:
It sounds like this can be done in Leaflet if all the points are added to a
FeatureGroup, then the bounds obtained withgetBounds(), thenfitBoundsmethod method called to zoom in.I'd give it a shot myself, but I'm still reading over the code to get a feel for how all of this fits together.
Beta Was this translation helpful? Give feedback.
All reactions