1

I want to maka a map with the following layer/data. But the map does not show up. This is the WMTS service: here

I am using programming language R and the leaflet package in R. My code looks like this:

library(leaflet)
library(leaflet.esri)

epsg28992 <- leafletCRS(
  crsClass = "L.Proj.CRS"
  ,code = "EPSG:28992"
  ,proj4def = "+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +towgs84=565.2369,50.0087,465.658,-0.406857330322398,0.350732676542563,-1.8703473836068,4.0812 +no_defs"
  ,origin=c(-3.05155E7,3.1112399999999993E7)
  ,resolutions = c(3251.206502413005,1625.6032512065026,812.8016256032513,406.40081280162565,203.20040640081282,101.60020320040641, 50.800101600203206,25.400050800101603,12.700025400050801,6.350012700025401,3.1750063500127004,1.5875031750063502,0.7937515875031751,0.39687579375158755,0.19843789687579377,0.09921894843789689,0.04960947421894844)
)

leaflet(options = leafletOptions(crs = epsg28992)) %>%
  setView(229684.400,513480.640,zoom = 10) %>%
  addEsriTiledMapLayer("https://tiles1.arcgis.com/tiles/nSZVuSZjHpEZZbRo/arcgis/rest/services/Historische_tijdreis_1996/MapServer/"
                       ,group = "Layer_1996" 
  )

But a grey map shows up.

Can you help me?

1
  • If you also wish to ask a question about Python then please do that in a separate one from this one that uses R. – PolyGeo Jul 16 at 11:24
2

I'm not familiar with Leaflet in R, but your problem is most probably use of projected coordinates in setView.

Regardless of map projection, Leaflet always requires unpprojected coordinates [lat, lng] as input to its functions/methods.

This worked for me OK in JS Leaflet:

var crs28992 = new L.Proj.CRS(
  'EPSG:28992',
  '+proj=sterea +lat_0=52.15616055555555 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +units=m +towgs84=565.2369,50.0087,465.658,-0.406857330322398,0.350732676542563,-1.8703473836068,4.0812 +no_defs',                        
  {
   origin: [-3.05155E7,3.1112399999999993E7],
   resolutions: [3251.206502413005,1625.6032512065026,812.8016256032513,406.40081280162565,203.20040640081282,101.60020320040641, 50.800101600203206,25.400050800101603,12.700025400050801,6.350012700025401,3.1750063500127004,1.5875031750063502,0.7937515875031751,0.39687579375158755,0.19843789687579377,0.09921894843789689,0.04960947421894844],
  }
);

var map = new L.Map('map', {
  crs: crs28992
}).setView([52, 5], 2);

L.esri.tiledMapLayer({
  url: 'https://tiles1.arcgis.com/tiles/nSZVuSZjHpEZZbRo/arcgis/rest/services/Historische_tijdreis_1996/MapServer/'
}).addTo(map);

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.