[Qgis-developer] secondary mapCanvas and memory layer

Massimo massimo.endrighi at geopartner.it
Tue Sep 11 03:34:12 PDT 2012


Hi,

I would like to show my spatial analysis results using a temporary "memory"
vector layer in a secondary mapCanvas hosted inside a python plugin widget.

I'dont know exactly:
- how to clone/copy a feature from an existing layer to a new temp "memory"
vector layer
- how to add the temp layer to my mapCanvas instance since
qgsMapLayerRegistry has only one global instance used by the qgis mapCanvas

The following code produces strange behaviours:
temp_layer = QgsVectorLayer('Polygon', 'temp_layer', 'memory')
temp_layer_provider = temp_layer.dataProvider()
temp_layer_provider.addFeatures([intersected_feature])
canvas_layer = QgsMapCanvasLayer (temp_layer)
self.map_canvas.setLayerSet([canvas_layer])
self.map_canvas.setExtent(temp_layer.extent())


Any help will be very appreciated.

Massimo





--
View this message in context: http://osgeo-org.1560.n6.nabble.com/secondary-mapCanvas-and-memory-layer-tp5001051.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list