Snapping the map to the bounds of the geojson layer
See original GitHub issueHey, just wanted to see if you had advice for snapping the map to the boundaries of the geojson layer? I know how I’d do it in vanilla JS, but since the geojson is initialized inside a child component, I’m not sure the best place to hook into it in order to fire the .getBounds()
and .fitBounds()
calls. My guess is to do it on mounted
and again on updated
using a ref
to the map and geojson layer but wanted to see if this was already thought through by chance?
Issue Analytics
- State:
- Created 6 years ago
- Comments:5
Top Results From Across the Web
Snapping the map to the bounds of the geojson layer · Issue #76
Hey, just wanted to see if you had advice for snapping the map to the boundaries of the geojson layer? I know how...
Read more >Geting fitBounds and removeLayers to work in Leaflet
I have been unsuccessful getting fitBounds to work. When the map loads a category of markers from the dropdown, I want any existing...
Read more >Working with large GeoJSON sources in Mapbox GL JS | Help
Tools like geojsplit make the process of breaking up GeoJSON sources manageable. Once the data has been divided, each source can be added...
Read more >Finding center and zoom level in leaflet, given a list of lat-long ...
The easiest way is with a LatLngBounds object. You can then have the map fitBounds. Or get its center manually if you prefer....
Read more >Maps & Geocoding with Vega-Lite and Leaflet | TUTORIAL ...
Mapping Layers on Leaflet's Maps: Polygons/Areas/Boundaries · Notice here how we're creating a new layer called grandCentralLayer , which takes in geoJSON info ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
FYI,
watch
didn’t quite work because it’s executed prior to the DOM updates, sothis.$refs.geojsonLayer
is not defined yet. I ended up calling it during theupdated
lifecycle hook.That sounds perfect, thanks!