alexandre-melard / leaflet.TileLayer.WMTS

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

Plugin assumes syntax of GetTile from base (GetCapabilities) URL #17

Open tomchadwin opened 6 years ago

tomchadwin commented 6 years ago

I'm trying to use this to connect to https://www.basemap.at/wmts/1.0.0/WMTSCapabilities.xml. That server's GetTile requests have the following syntax:

https://maps1.wien.gv.at/basemap/geolandbasemap/{Style}/{TileMatrixSet}/{TileMatrix}/{TileRow}/{TileCol}.png

I think that leaflet.TileLayer.WMTS assumes a key=val querystring structure. However, the above service expects the parameters as part of the URL path, not as querystring variables, so it doesn't work.

Is there a way of parsing the GetCapabilities string to get the correct GetTile syntax?

palmerj commented 6 years ago

Yes the WMTS standard support both KVP and REST resource methods. This plugin is only supporting the KVP request method at the moment.

FrankyBoy commented 4 years ago

So ... any plans of fixing this? I just ran into the same issue and this basically means the library is useless to me. Which in turn means Leaflet is useless to me.

jnachtigall commented 4 years ago

I solved this issue by overwriting the way the URL is assembled in getTileUrl by changing the path from https://github.com/alexandre-melard/leaflet.TileLayer.WMTS/blob/d5d162d60cb204a0f9dbde2905d5d68c790faf16/leaflet-tilelayer-wmts-src.js#L59

to something like

    var tileUrl =
      url +
      this.wmtsParams.layer +
      "/" +
      this.wmtsParams.tilematrixset +
      "/" +
      ident +
      "/" +
      tilecol +
      "/" +
      tilerow;
    return tileUrl;