<div dir="ltr"><div><div><div><div><div><div><div>I found a way to have coordinates:<br></div><div><div class="im"><br>layer = qgis.utils.iface.activeLayer()<br>for elem in layer.getFeatures():<br> geom= elem.geometry()<br>
</div><br> elem = geom.asPolygon()<br><br> for iii in range (len(elem)):<br> for jjj in range (len(elem[iii])):<br> <br> x1,y1 = elem[iii][jjj][0], elem[iii][jjj][1]<br>
<br><br></div></div>Is this the unique way ? Nothing of more elegant ?<br><br></div>For what reason, in the linestring case I can write something like this:<div class="im"><br><br>layer = qgis.utils.iface.activeLayer()<br>
for elem in layer.getFeatures():<br> geom= elem.geometry()<br></div> poly = geom.asPolyline()<br><br> for p1 in elem:<br> x1,y1 = p1.x(),p1.y() <br> print ('%lf,%lf \n') % (x1,y1)<br>
<br><br></div></div>...and, instead, in polygon there is not a x() y() method ?<br><br>:)<br><br><br><br></div>Thank you<br><br></div>Roberto</div>