5

Is it possible to set a fixed reference scale for a QGIS layer using PyQGIS?

enter image description here

I try this script but it doesn't work:

lyr = iface.activeLayer()

r = QgsFeatureRenderer()
r.setReferenceScale(400_000)
lyr.setRenderer(r)

1 Answer 1

6

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)
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.