[Qgis-developer] How to get feat.geometry() from SpatiaLite in pyQGis ?
Geo DrinX
geodrinx at gmail.com
Thu Dec 5 02:10:03 PST 2013
Hello all,
as in object, within pyQGis I need to read the geometry of a SpatiaLite
vector layer.
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:
ELEM []
ELEM []
ELEM []
ELEM []
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
Roberto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131205/34572f64/attachment.html>
More information about the Qgis-developer
mailing list