I am using the Leaflet.TileLayer.WMTS plugin (https://github.com/mylen/leaflet.TileLayer.WMTS). However, I believe that this only works with WMTSes which add parameters to GetTile
requests as querystring variables in key=val pairs (eg http://www.provider.net/path?var1=val1&var2=val2 etc). I need to add a WMTS which uses a URL path for its parameters (eg http://www.provider.net/path/val1/val2 etc). The WMTS in question is https://www.basemap.at/wmts/1.0.0/WMTSCapabilities.xml.
The way other clients handle this is by parsing the GetCapabilities
URL, which provides the parameter mapping for GetTile
requests. I see that OpenLayers has a method for parsing GetCapabilities
to add the WMTS (https://openlayers.org/en/latest/examples/wmts-layer-from-capabilities.html).
I'm aware that at least one other question has this as the underlying issue (https://stackoverflow.com/questions/44300140/wmts-layer-syntax-for-leaflet), but it doesn't make it clear what the underlying problem is, so I thought it was worth asking a new question.
I know that I can either read the GetCapabilities
XML myself (or look at network requests from a working client) and determine the structure to add a plain XYZ tileserver. However, I am trying to code this into qgis2web, which needs to accomplish this programmatically.
So, is there any way of adding a WMTS to a Leaflet webmap if you only have the URL for its GetCapabilities
method?