3

I'm developing a plugin in Python for QGIS.

I would like the user to select a particular area in a list (let's say a country list) and zoom in the map on the corresponding area.

Actually I'm doing it 'ugly':I create a layer (from a WKT), zoom to this particular layer, and delete this layer...

Is there a way to do it properly?

1 Answer 1

1

Try this:

rect = geometry.boundingBox()
iface.mapCanvas().setExtent(rect)
iface.mapCanvas().refresh()
1
  • The problem with this, is that some other plugins does the same at launch time.
    – Djabx
    Commented Jul 24, 2012 at 9:08

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.