I've been trying to access the polygons of a dissolved layer in QGIS, and every time I query them, I get an empty polygon back. My procedure is as follows:
- I start with a layer of polygons, and use the dissolve feature to dissolve some of them (this is not a problem, and the layer is generated, and I can see it, highlight it, and interact with its features)
In the python console, I find a feature in this layer, and type:
even though I can highlight it in the map interface.
Am I misunderstanding the scope of the asPolygon() function?
I figured out my mistake! To all future readers: the dissolve function may output multiple polygons as a single feature, meaning that they are a multipolygon, not a polygon. Thus, the function that should be called is geometry().asMultiPolygon() to return the co-ordinates.