Search code examples
rr-leaflet

Display David Rumsey' Georeferencer tiles in R leaflet


I am trying tu use David Rumsey' Georeferencer tiles in R leaflet package without success (Only the OSM basemap is displayed). enter image description here According to the package vignette I tried:

   library(leaflet)
            # XYZ direct link                
            leaflet() %>%
              setView(0.65, 0, zoom = 5) %>%
              addTiles() %>% 
              addTiles("https://maps.georeferencer.com/georeferences/700526190853/2017-12-30T11:48:27.589686Z/map.json?key=D7AwmpRP1H6pUic6DIK3") 

and

 library(leaflet)
            # WMS tiles
    leaflet() %>% 
      addTiles() %>% setView(0.65, 0, zoom = 5) %>%
      addWMSTiles(
        "https://maps.georeferencer.com/georeferences/700526190853/2017-12-30T11:48:27.589686Z/wmts?key=D7AwmpRP1H6pUic6DIK3&SERVICE=WMTS&REQUEST=GetCapabilities",
    layers = "1", # I assume
    options = WMSTileOptions(format = "image/png", transparent = FALSE),
    attribution = "") 

Notes:

  • The access at the map links need free registration.
  • I used the 2.1 package release.
  • The vignette's addWMSTiles example is working on my computer.

Solution

  • I solve my problem using the addLayersControl function that can allow me to choose the layer to display.

           library(leaflet)
          m <- leaflet() %>%
            addProviderTiles(providers$CartoDB.DarkMatterNoLabels, group = "DarkMatter") %>%
          addTiles("https://maps.georeferencer.com/georeferences/700526190853/2017-12-30T11:48:27.589686Z/map/{z}/{x}/{y}.png?key=D7AwmpRP1H6pUic6DIK3", group ="H") %>% 
            addLayersControl(
        baseGroups = c("DarkMatter", "H"), position ="topleft")
          m