在R小册子中展示David Rumsey的Georeferencer瓷砖

时间:2018-06-14 11:35:02

标签: r leaflet

我正在尝试在R小册子包中使用David Rumsey'Georeferencer tiles但没有成功(仅显示OSM底图)。 enter image description here 根据我试过的package vignette

   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") 

 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 = "") 

注意:
- 地图链接访问需要免费注册 - 我使用2.1包发布。
- 插图的addWMSTiles示例正在我的计算机上运行。

1 个答案:

答案 0 :(得分:0)

我使用addLayersControl函数解决了我的问题,可以让我选择要显示的图层。

       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