<div dir="ltr"><div><div><div><div><div><div><div><div><div><div>Hello all,<br><br><br></div>as in object, within pyQGis I need to read the geometry of a SpatiaLite vector layer.<br><br></div>This is my source code:<br><br>
layer = iface.mapCanvas().currentLayer()<br>iter = layer.getFeatures()<br>for feat in iter:<br> geom = feat.geometry()<br> elem = geom.asPolyline()<br> print("ELEM %s\n") %(elem) <br> for p1 in elem:<br>
x1,y1 = p1.x(),p1.y()<br> print("XY= %lf %lf\n") %(x1, y1) <br><br><br></div>But... it returns only:<br><br></div>ELEM []<br>ELEM []<br>ELEM []<br>ELEM []<br><br></div>etcetera, instead of something like this :<br>
<br>ELEM [(2.37786e+06,4.60302e+06), (2.37784e+06,4.60304e+06)]<br><br></div>... that I had with a "normal" qgis layer.<br><br></div>Sure, I miss something.<br><br></div>Somebody can help me to understand how to get geometry from SpatiaLite ?<br>
<br><br></div>Thank you in advance<br><br></div>Roberto<br><div><div><div><div><div><div><br><div><div><br><br></div></div></div></div></div></div></div></div></div>