I'm using PyQGIS to add QgsRasterLayer
layers to my project.
This is how I create the layer:
urlWithParams = "type=xyz&url=http://ecn.t3.tiles.virtualearth.net/tiles/a%7Bq%7D.jpeg?g=1"
rlayer = QgsRasterLayer(urlWithParams, "Bing maps", "wms")
I can set their max zoom level via the QGIS UI (Properties -> Source -> Max Zoom Level, see attached image), but I'd like to do it programmatically via PyQGIS. I've found that this class has the setMaxZoomLevel
method:
https://www.qgis.org/pyqgis/master/core/QgsVectorTileBasicRendererStyle.html
but I cannot find how to go from a QgsRasterLayer
to its QgsVectorTileBasicRendererStyle
.
Has anyone done it?