oats-center / grow

0 stars 3 forks source link

Zoom to shape for map view #12

Open abalmos opened 2 years ago

abalmos commented 2 years ago

Currently the map view loads each field individually and zooms to each one rapidly.

That is a pretty jarring experience.

Maybe we should load each field's <GeoJson /> into a <FeatureGroup /> (need to create a Svelte wrapper), so we can find the bounds of the whole group (https://leafletjs.com/reference.html#featuregroup-getbounds) and zoom to that on the inital load. https://github.com/oats-center/grow/blob/b6831624a317635a6d255e5033ae5cc4423b7ddc/src/lib/leaflet/GeoJson.svelte#L29-L31