无法将WMS图层添加到R Leaflet

问题描述 投票:0回答:1

我想用这个 wms 服务在 R 中制作传单地图:https://data.geopf.fr/wms-r/wms?VERSION=1.3.0 它在 QGIS 中运行良好,但在 addWMSTiles 中运行不佳。

library(leaflet)

layer="ADMINEXPRESS-COG-CARTO.LATEST"
url="https://data.geopf.fr/wms-r/wms?VERSION=1.3.0"

leaflet() %>% 
    setView(lng=3.18766,lat = 50.46302,zoom = 12) %>%
    addWMSTiles(
      baseUrl = url,
      layers = layer,
      group = "Limites administratives",
      options = WMSTileOptions(format = "image/png", transparent = TRUE,opacity=0.9,crs = 4326),
      attribution = "IGN"
    ) 

我尝试leaflet.extras2 pakcage,我尝试将层数设置为this post,但它根本不起作用。我尝试更改基本网址... 我在 qgis 中查找信息但没有成功。

r leaflet wms r-leaflet
1个回答
0
投票

我找到了答案。 我必须在

WMSTileOptions
中指定服务的版本,这很奇怪,因为它与旧服务的版本相同......

library(leaflet)

layer="ADMINEXPRESS-COG-CARTO.LATEST"
url="https://data.geopf.fr/wms-r/wms?VERSION=1.3.0"

leaflet() %>% 
    setView(lng=3.18766,lat = 50.46302,zoom = 12) %>%
    addWMSTiles(
      baseUrl = url,
      layers = layer,
      group = "Limites administratives",
      options = WMSTileOptions(
          format = "image/png",
          transparent = TRUE,
          opacity=0.9,
          crs = 4326,
          version="1.3.0"
        ),
      attribution = "IGN"
    )
© www.soinside.com 2019 - 2024. All rights reserved.