alexandre-melard / leaflet.TileLayer.WMTS

Add WMTS layering for leaflet
Other
78 stars 84 forks source link

not working for QGIS server WMTS #29

Open mosikh opened 11 months ago

mosikh commented 11 months ago

Hello, I need to show some WMTSs offered by QGIS server on leaflet map. Unfortunately, your module doesn't support QGIS server WMTS. Could you please let me know if there is another solution? or could you please update this module to get usable for QGIS server WMTS.

It is my code:

var qgisUrl = 'http://localhost/cgi-bin/qgis_mapserv.fcgi.exe?MAP=C:/Users/mkheyrollahi/Downloads/221103-BBVPlanauskunftServer-v3.qgs';

var ign = new L.TileLayer.WMTS(qgisUrl, { layer: 'Bretten', tilematrixSet: "EPSG:3857", format: "image/png", attribution: "attribution", } );

map.addLayer(ign);

The error that I get several times during the navigation on my leaflet map is as follows:

GET http://localhost/cgi-bin/qgis_mapserv.fcgi.exe?MAP=C:/Users/mkheyrollahi/Downloads/221103-BBVPlanauskunftServer-v3.qgs&service=WMTS&request=GetTile&version=1.0.0&layer=Bretten&style=&tilematrixset=EPSG%3A3857&format=image%2Fpng&height=256&width=256&tilematrix=EPSG:3857:8&tilerow=87&tilecol=135 400 (Bad Request)

When I open the link in the error message, I get this error there:

TILEMATRIX ('EPSG:3857:8') cannot be converted into int

QGIS server WMTS accepts usually just one integer number for tilematrix. Otherwise, it doesn't work.

By the way, the provided WMTS works well with no error on browser and Openlayers environment.

On the other hand, I used this module with the same code, too:

This module is a bit better but not good enough. It shows my WMTS layer partially and randomly on some zoom levels with no logic. The performance is poor. It sometimes shows half of the layer, sometimes the whole layer and sometimes nothing. It gives this error several times when navigating on the leaflet map:

GET http://localhost/cgi-bin/qgis_mapserv.fcgi.exe?MAP=C:/Users/mkheyrollahi/Downloads/221103-BBVPlanauskunftServer-v3.qgs&service=WMTS&request=GetTile&version=1.0.0&layer=Bretten&style=&tilematrixSet=EPSG%3A3857&format=image%2Fpng&height=256&width=256&attribution=dd&zIndex=1000&tilematrix=8&tilerow=173&tilecol=270 400 (Bad Request)

When I open the link in the error message, I get this error there:

TileCol is unknown

Thanks for your time and consideration.

Best regards, Mostafa