[Qgis-developer] How to get feat.geometry() from SpatiaLite in pyQGis ?

mmekuria sailmcm at yahoo.com
Thu Dec 5 20:53:27 PST 2013

Hi, Roberto:

I think the query from layer.getFeatures() returns an iterator and that
means you use the nextFeature(feat) to get the next feature until it fails
to return a feature, then it means you have reached the end of the iterator

iter = layer.getFeatures()
while iter.nextFeature(feat):
    geom = feat.geometry()
    elem = geom.asPolyline()
    print("ELEM %s\n") %(elem)    
    for p1 in elem:
        x1,y1 = p1.x(),p1.y()
        print("XY= %lf %lf\n") %(x1, y1) 

Should work for you,

Maaza Christos, PhD

View this message in context: http://osgeo-org.1560.x6.nabble.com/How-to-get-feat-geometry-from-SpatiaLite-in-pyQGis-tp5092891p5093041.html
Sent from the Quantum GIS - Developer mailing list archive at Nabble.com.

More information about the Qgis-developer mailing list