Geographic Information Systems Asked by Elías De La Rosa on December 4, 2020
I am using Openstreetmaps with R/Shiny. I am trying to restrict map display to a given range of coordinates, i.e.xmin, ymin, xmax, ymax
so that the users of the map won’t be able to look other parts of the world other than the ones that are within the range.
I’ve made some research about it, but it hasn’t been possible to find an answer. How can I do that?
According to this github issue:
https://github.com/rstudio/leaflet/issues/486
you should be able to specify max bounds and min/max zoom levels with code like this
myMap <- leaflet(options = leafletOptions(minZoom = 11)) %>%
addProviderTiles("OpenStreetMap") %>%
setView( lng = -87.567215
, lat = 41.822582
, zoom = 11 ) %>%
setMaxBounds( lng1 = -87.94011
, lat1 = 41.64454
, lng2 = -87.52414
, lat2 = 42.02304 )
Answered by Dataform on December 4, 2020
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP