[Qgis-developer] How to get feat.geometry() from SpatiaLite in pyQGis ?
geodrinx at gmail.com
Thu Dec 5 02:10:03 PST 2013
as in object, within pyQGis I need to read the geometry of a SpatiaLite
This is my source code:
layer = iface.mapCanvas().currentLayer()
iter = layer.getFeatures()
for feat in iter:
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)
But... it returns only:
etcetera, instead of something like this :
ELEM [(2.37786e+06,4.60302e+06), (2.37784e+06,4.60304e+06)]
... that I had with a "normal" qgis layer.
Sure, I miss something.
Somebody can help me to understand how to get geometry from SpatiaLite ?
Thank you in advance
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Qgis-developer