r-tmap / r-tmap/tmap

setting max native zoom automatically

Open
#880 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

View-mode
Dominant language
R
Stars
907
Forks
123
PR merge metrics
No merged PRs in 30d

Description

?tm_view mentions passing options to leafletOptions() via leaflet.option=, but I can't seem to get this to work for leaflet::providerTileOptions. Example below:

not working:

library(sf)
library(tmap)
library(leaflet)

# set coord
heron_island_coords <- st_sfc(st_point(c(151.9110, -23.4421)), crs = 4326) |> 
  st_transform(crs = 20355)

#tmap
tmp_map <- tm_basemap("Esri.WorldImagery") +
tm_shape(heron_island_coords) +
  tm_dots() +
tm_view(set.zoom.limits=c(18,30), leaflet.options = providerTileOptions(maxNativeZoom=18,maxZoom=100))

tmp_map

working via tmap_leaflet():

tmp_map |>  tmap_leaflet() |>
  leaflet::addProviderTiles('Esri.WorldImagery', options=leaflet::providerTileOptions(maxNativeZoom=18,maxZoom=100)) 

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing the tm_view() leaflet.options path with the working tmap_leaflet() call and leaflet::providerTileOptions(maxNativeZoom=18, maxZoom=100) example. Check whether the provider tile options are forwarded when the map is rendered. Done means both zoom limits take effect in the rendered tmap map, with a regression test covering the options.

Written by the indexing model from the issue text.

Assessment

Tech stack
r
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.