[Qgis-developer] Poligon coordinates in PyQgis 2

Geo DrinX geodrinx at gmail.com
Fri Oct 18 00:13:19 PDT 2013


> in the same way as before but with layer.getFeatures():
>
>         layer = qgis.utils.iface.activeLayer()
>         for elem in layer.getFeatures():
>                 geom= elem.geometry()
>                 poly = geom.asPolygon()
>
>        poly.wkbType() == QGis.WKBPolygon
>        True
>        # coordinates of vertex:
>        print poly
>        [[(232139,110988), (232673,110410), (232311,110090),
> (231814,110190),
> (231684,110648), (232139,110988)]].
>

...strange, because also using your code, I had this error

poly.wkbType() == QGis.WKBPolygon
AttributeError: 'list' object has no attribute 'wkbType'

What I do not understand is:  for what reason getting coordinates is
different from Lines and Polygon ?
Perhaps, Is this a new of PyQGis 2 ?


Thank you

Roberto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131018/b009008a/attachment.html>


More information about the Qgis-developer mailing list