1

I have a standalone geowebcache, I want to use it to serve wmts to a leaflet map but I find it hard to understand what url to use.

Displaying the layers in QGIS work fine when I add the server using the url http://localhost:8080/geowebcache/service/wmts/

But how do I find out what the url should be for leaflet? If I check getCapabilities i find http://localhost:8080/geowebcache/service/wmts/rest/test_layer/{style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}?format=image/png
But how do I implement that?

I am using default style. I have created a custom TileMatrixSet called "EPSG:3857"
I tried this without luck

L.tileLayer('http://localhost:8080/geowebcache/service/wmts/rest/test_layer/EPSG:3857/{z}/{y}/{x}?format=image/png')

Previously I have successfully displayed layers in leaflet using tms from geoserver using the structure below, but for some reason i get 400 error now.

L.tileLayer('http://localhost:8080/geowebcache/service/tms/1.0.0/test_layer@EPSG:3857@jpeg{z}/{x}/{-y}.jpeg')

Really scratching my head here because I try to understand where I should look and and how I can implement this properly? Is it possibly to use wmts with leaflet? I found a wmts plugin for leaflet https://github.com/alexandre-melard/leaflet.TileLayer.WMTS but is that really the only/recommended way to do it?

EDIT: This url is working L.tileLayer('http://localhost:8080/geowebcache/service/wmts?layer=test_layer&style=&tilematrixset=EPSG:3857&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/jpeg&TileMatrix=EPSG:3857:{z}&TileCol={x}&TileRow={y}')

But I dont understand how I can get there from looking at getCapabilities alone? I found out by looking in the network tab for from geowebcache/demo. But how I know how to from `

http://localhost:8080/geowebcache/service/wmts/rest/test_layer/{style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}?format=image/png

to

http://localhost:8080/geowebcache/service/wmts?layer=test_layer&style=&tilematrixset=EPSG:3857&Service=WMTS&Request=GetTile&Version=1.0.0&Format=image/jpeg&TileMatrix=EPSG:3857:{z}&TileCol={x}&TileRow={y}

that I dont understand?

  • 1
    It seems you are missing {style} parameter in your WMTS url, which is usually default. There should be also {z} instead of first {y}. – TomazicM Aug 25 at 8:55
  • oh the z was a typo in my post, I will edit that. I left out style all together because i am using default style. I just tried use "default" in the url like so: thathttp://localhost:8080/geowebcache/service/wmts/rest/test_layer/default/EPSG:3857/{z}/{y}/{x}?format=image/png (did not work), seems odd to me to inklude style name like that as part as the url, and not as a parameter? – geogrow Aug 25 at 9:37
  • This is working:L.tileLayer('localhost:8080/geowebcache/service/…:{z}&TileCol={x}&TileRow={y}'); But I dont know how i can get to that by looking at the getCapabilities alone?? I checked the network tab in the "preview" demo map from geowebcache/demo to fish for it. – geogrow Aug 25 at 9:45

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.