0

I am making maps in leaflet and cannot change the zoom increment for some reason.

I don't have the option to use

var map = L.map('map', {
  zoomSnap: 0.25
});

I also don't have these functions available:

options = leafletOptions(zoomControl = TRUE,
                                        zoomSnap = 0.25,
                                        zoomDelta))

This is my code so far:

map <- leaflet(Reservoir_locations) %>%
  addTiles() %>%
  setView(lat = 52.5, lng = -3.005, zoom = 09) %>%
  addProviderTiles(providers$JusticeMap.asian) %>%
  addCircleMarkers(
    fillColor = "Blue",
    radius = 14,
    fillOpacity = 1,
    stroke = F,
    ~LON, ~LAT) %>%
  addScaleBar(options = scaleBarOptions(
  maxWidth = 300,
  metric = TRUE,
  imperial = TRUE,
  updateWhenIdle = TRUE
))

map 

The resulting map is too zoomed in, but it's too small when I adjust the zoom.

I would like to be able to zoom by x0.25 increments if possible.

Any help would be much appreciated.

Many thanks,

A

4
  • Do you mean you use Leaflet with R? And that the R Leaflet wrapper lacks the zoomSnap option?
    – ghybs
    Commented Oct 17, 2022 at 1:09
  • I am not sure, I just dont have the option available to use zoomControl or any of the other code I have included @ghybs
    – ASHooper93
    Commented Oct 17, 2022 at 8:37
  • is it because I need the geodesy package? because I have tried to install this but its not suitable for my version of R apparently and I cant seem to google how to force installation. Worried about updating my R because all my packages currently work.
    – ASHooper93
    Commented Oct 17, 2022 at 8:47
  • ‘leaflet’ version 2.1.1 is the version I am using and it is driving me crazy that var map = L.map() isn't coming up as a usable function
    – ASHooper93
    Commented Oct 17, 2022 at 9:27

0

Browse other questions tagged or ask your own question.