Is it possible to set a fixed reference scale for a QGIS layer using PyQGIS?
I try this script but it doesn't work:
lyr = iface.activeLayer()
r = QgsFeatureRenderer()
r.setReferenceScale(400_000)
lyr.setRenderer(r)
You can set a reference scale by getting the renderer of the active layer. You don't need to make a new QgsFeatureRenderer
.
lyr = iface.activeLayer()
r = lyr.renderer()
r.setReferenceScale(400_000)