versión de esri-leaflet: 3.0.12
versión de leaflet: 1.9.4
¡Hola! Estoy creando un mapa con múltiples capas superpuestas.
El mapa base usa el valor CRS predeterminado de leaflet y esto se muestra sin problemas. Pero cuando intento superponer una capa con un valor CRS diferente, por ejemplo el siguiente mapa arcgis: https://tiles.arcgis.com/tiles/nSZVuSZjHpEZZbRo/arcgis/rest/services/Historische_tijdreis_2023/MapServer
Me da un error 404 no encontrado al cambiar a esta capa específica.
(Error al cargar recurso: el servidor respondió con un estado 404 (https://tiles2.arcgis.com/tiles/nSZVuSZjHpEZZbRo/arcgis/rest/services/Historische_tijdreis_2023/MapServer/tile/11/675/1058))
Cargo mi mapa base de la siguiente manera:
this.leafletMap = L.map(config["map-element-id"], {
attributionControl: false,
zoomSnap: 0.1,
crs: L.CRS.EPSG3857, // Usar CRS predeterminado para la capa del mapa base
layers: [L.tileLayer("https://tile.openstreetmap.org/{z}/{x}/{y}.png")],
});
Y cambio la capa así:
this.historicalCrs = new L.Proj.CRS(
"EPSG:28992",
"+proj=sterea +lat_0=52.1561605555556 +lon_0=5.38763888888889 +k=0.9999079 +x_0=155000 +y_0=463000 +ellps=bessel +towgs84=565.4171,50.3319,465.5524,1.9342,-1.6677,9.1019,4.0725 +units=m +no_defs +type=crs",
{
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,
]
}
);
updateHistoricalLayer(element) {
const self = this;
if (this.activeHistoricalLayer) {
this.leafletMap.removeLayer(this.activeHistoricalLayer);
this.activeHistoricalLayer = null;
}
for (const index in this.historicalLayers) {
const layer = this.historicalLayers[index];
if (layer.id === element.value) {
if (layer.wms) {
this.activeHistoricalLayer = L.tileLayer.wms(layer.wms, {
layers: layer.layer,
});
} else if (layer.wmts) {
this.activeHistoricalLayer = L.esri.tiledMapLayer({
url: "https://tiles.arcgis.com/tiles/nSZVuSZjHpEZZbRo/arcgis/rest/services/Historische_tijdreis_2023/MapServer",
# crs: this.historicalCrs, INTENTÉ AGREGARLO AQUÍ PERO NO HACE NADA
continuousWorld: true,
});
}
if (this.activeHistoricalLayer) {
if (layer.wmts) {
this.leafletMap.options.crs = this.historicalCrs;
}
console.log(this.activeHistoricalLayer);
this.leafletMap.addLayer(this.activeHistoricalLayer);
}
document
.querySelectorAll("input[name=historical-layer-opacity]")
.forEach((element) => {
self.setHistorcialLayerOpacity(element);
});
break; // Capa encontrada y agregada, salir del bucle
}
}
}
Sé que mi problema tiene que ver con la proyección (CRS) pero no puedo identificar exactamente qué está fallando. Y agradecería mucho si alguien pudiera orientarme en la dirección correcta.
(Si se necesita más información/contexto por favor avísenme y lo proporcionaré)