I use:

from urllib.parse import parse_qs

d = parse_qs(layer.source())
if 'tileMatrixSet' in d:
    useWMTS = True
    wmts_url = d['url'][0].replace("request=getcapabilities", "")
    wmts_layer = d['layers'][0]
    wmts_format = d['format'][0]
    wmts_crs = d['crs'][0]
    wmts_style = d['styles'][0]
    wmts_tileMatrixSet = d['tileMatrixSet'][0]

Source is here:
https://github.com/tomchadwin/qgis2web/blob/master/qgis2web/leafletScriptStrings.py#L288

Hope this helps

Tom



-----
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon 
--
Sent from: http://osgeo-org.1560.x6.nabble.com/QGIS-Developer-f4099106.html
_______________________________________________
QGIS-Developer mailing list
[email protected]
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to