I am trying to add a WMTS raster layer in QGIS 3.8 using Python (for my plugin).
I have found this Loading Layers - Raster in the documentation, but I cannot make it work.
I tried this:
QgsRasterLayer(f'url={url}&crs=EPSG:4326&format=image/png&tileMatrixSet=4326&username={name}&password={pwd}', 'some layer name', 'wmts').isValid()
But it returns False.
I see the same question asked a lot on this site, but no answer solves my problem.
How can I deal with this?
The URL works fine when I add the layer through the UI.
Other post : Loading a WMS layer to QGIS using python
f'url={url}?crs...or if url has a ? justf'url={url}crs...as per syntaxkey[=value]&– nmtoken Oct 24 '19 at 16:47