[QGIS-Developer] How to split QGISMapLayer attribute "source" into parts (python)

Tom Chadwin tom.chadwin at nnpa.org.uk
Thu Apr 25 04:42:06 PDT 2019


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


More information about the QGIS-Developer mailing list