ol-ext
ol-ext copied to clipboard
Géoplateforme PCRS layer not working ?
Hello,
I've been trying to make the work-in-progress PCRS layer display in Openlayers using ol-ext but I can't get it to work. Using this very simple code taken from the Geoportail example doesn't work.
ol.layer.Geoportail.register("PCRS.LAMB93", {"layer":"PCRS.LAMB93","theme":"parcellaire","desc":"Données du Plan Corps de Rue Simplifié","server":"https://data.geopf.fr/wmts","bbox":[-5,40,10,52],"format":"image/jpeg","tilematrix":"PM","minZoom":6,"maxZoom":22,"originators":{"Geoservices":{"attribution":"Géoservices","href":"https://geoservices.ign.fr/"}},"queryable":true,"style":"normal","tilematrix":"PM","title":"PCRS","legend":["http://ign.fr"]});
var testLayer = new ol.layer.Geoportail({ layer: 'PCRS.LAMB93' });
I get this error :
TileMatrixSet PM inconnu pour le layer.
It seems to me that ol-ext or Openlayers cannot recognize the matrix used. It's not PM but, according to the GetCapabilities document, LAMB93_5cm.
I tried replacing "tilematrix":"PM" with "tilematrix":"LAMB93_5cm" in the register function to no avail. I also tried using the vanilla openlayers WMTS implementation but wasn't able to find how to make it work either because I'm not very knowledgeable about tile matrixes.
The issue is the ol/layer/Geoportail
only support PM
tilematrix and EPSG:3857
projection.
If you want to use another projections you have to set your own WMTS layer.
You also have to load the projection definition (using proj4) and your map must be in this projection (or compatible).
Maybe you can use the WMTSCapabilities
to help you defining the source: https://viglino.github.io/ol-ext/examples/layer/map.wmtscapabilities.html
You have to add the supported projection to the control:
ol.control.WMSCapabilities.prototype.supportedSets.push('LAMB93_5cm')
In the debuger you can see the result but you have to set the correct tileGrid
for the projection...