4

I would like to load a vector memory layer into the map canvas with pyQGIS. Background is, I create a memory buffer layer around point data. While iterating the points I would like to visualize the buffer around each point in the map canvas and if possible automatically zoom to the memory layer. Is that possible?

Thanks

1

First makesure your mamory layer is added to the registry with

QgsMapLayerRegistry.instance().addMapLayer(memorylayer)

Now you can activate your memory layer with

qgis.utils.iface.setActiveLayer(memorylayer)

Now you can then zoom to the extents of that layer with

qgis.utils.iface.zoomToActiveLayer()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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