r-spatial / mapedit

Interactive editing of spatial data in R
https://www.r-spatial.org/r/2019/03/31/mapedit_leafpm.html
Other
218 stars 33 forks source link

editFeatures of only one point zooms in to zoom level 100 #35

Closed tim-salabim closed 7 years ago

tim-salabim commented 7 years ago

editFeatures(breweries[1, ]) will zoom in to a zoom level of 100 in the initial view. This is, I assume, because zoom level 100 is the maxZoom defined in mapview (to enable scrolling past the default zoom of 18/19 to investigate whether a line may actually be a polygon - useful for sliver polygons). I think we need to use leaflet's default expandLimits (or similar) to initiate the view.

tim-salabim commented 7 years ago

On further investigation I think this stems from these lines. We could leverage mapview:::createExtent (which is also used for setting the view of the homebutton. Thought this function could be enhanced a little as it zooms out too far at the moment for one point only. I will investigae in mapview....

timelyportfolio commented 7 years ago

Happy to work on this. Just let me know.

tim-salabim commented 7 years ago

If you could that would be great. I think this is two-fold. mapview:::createExtent is a mapview function that mostly behaves like the default leaflet initial view but ever so often (e.g. for single points) doesn't. If we could get this behaving similar to how leaflet determines the initial view for features that would be very beneficial for both mapview and mapedit. Note though, that there are instances in mapview where we need createExtent to mimic exactly st_bbox or raster::extent, i.e. in viewExtent

tim-salabim commented 7 years ago

this should be fixed via 9f35a9ebf76d2064fd90ae62578a096a8359f723

timelyportfolio commented 7 years ago

Thanks!!!! Verified working on my end.