0

I am trying to load historical map tiles from a WMS-server (GetCapabilities) and display them using R Leaflet.

Using the default CRS in Leaflet works fine, using e.g.:

leaflet() %>% 
  setView(4.69839084, 50.880089, zoom = 14) %>%
  addWMSTiles(
    "https://geoservices.informatievlaanderen.be/raadpleegdiensten/histcart/wms",
    layers = list("ferraris"),
    options = WMSTileOptions(format = "image/png"),
    attribution = "Source: GIS Geoservices Informatie Vlaanderen")

However, the projection should be Belge 1972 / Belgian Lambert 72 (EPSG:31370).

I can specify an example CRS (EPSG:3006), and the tiles still load:

epsg3006 <- leafletCRS(crsClass = "L.Proj.CRS", code = "EPSG:3006",
  proj4def = "+proj=utm +zone=33 +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs",
  resolutions = 2^(13:-1), # 8192 down to 0.5
  origin = c(0, 0)
)
leaflet(options = leafletOptions(crs = epsg3006)) %>%
...

However, using the epsg.io Proj4js-string for EPSG:31370 results in gray/blank tiles in R Leaflet:

epsg31370 <- leafletCRS(
  crsClass = "L.Proj.CRS", code = "ESRI:31370",
  proj4def = "+proj=lcc +lat_1=51.16666723333333 +lat_2=49.8333339 +lat_0=90 +lon_0=4.367486666666666 +x_0=150000.013 +y_0=5400088.438 +ellps=intl +towgs84=-106.869,52.2978,-103.724,0.3366,-0.457,1.8422,-1.2747 +units=m +no_defs",
  resolutions = 2^(13:-1), # 8192 down to 0.5
  origin = c(0, 0))

leaflet(options = leafletOptions(crs = epsg31370)) %>%
  setView(4.69839084, 50.880089, zoom = 14) %>% # center on Leuven
  addWMSTiles(
    baseUrl = "https://geoservices.informatievlaanderen.be/raadpleegdiensten/histcart/wms",
    layers = list("ferraris"), # request Ferraris-tiles from available WMS tilesets
    options = WMSTileOptions(format = "image/png"),
    attribution = "Source: GIS Geoservices Informatie Vlaanderen") %>%
  addControl("Leuven on the Ferraris map (1777)", position = "topright")

Additionally/possibly related:

  • I'm not sure how the resolutions-arguments work. Should I be able to find that through WSM GetCapabilities?
  • Proj4js returns a depreciation warning:

Warning in leafletCRS(crsClass = "L.Proj.CRS", code = "ESRI:102003", proj4def = "+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 +x_0=0 +y_0=0 +datum=WGS84 +units=m +no_defs", : projectedBounds argument is deprecated and has no effect, use the bounds argument.

  • Do you mean ESRI:31370 in your code, the service has EPSG:31370 – nmtoken Jan 7 at 13:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.