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

ghybs
  • 47,565
  • 6
  • 74
  • 99
ASHooper93
  • 27
  • 3
  • Do you mean you use Leaflet with R? And that the R Leaflet wrapper lacks the zoomSnap option? – ghybs Oct 17 '22 at 01: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 Oct 17 '22 at 08: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 Oct 17 '22 at 08: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 Oct 17 '22 at 09:27

0 Answers0