[Qgis-developer] How to get feat.geometry() from SpatiaLite in pyQGis ?
Geo DrinX
geodrinx at gmail.com
Fri Dec 6 01:23:52 PST 2013
Hi Christos (!),
sorry but your code works only in QGis 1.8 version.
I am using the 2.0.1 version and pyQGis methods are changed:
http://hub.qgis.org/wiki/quantum-gis/Python_plugin_API_changes_from_18_to_20
BTW, my problem is:
- using a SHP file layer, elements are returned
- using SpatiaLite layer, elements are returned, but each is empty.
It 'a known issue?
Someone in the list has tried it?
Roberto
2013/12/6 mmekuria <sailmcm at yahoo.com>
> 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
> list.
>
> 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
> www.Axumcorp.com
>
> --
> 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.
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131206/010fc116/attachment.html>
More information about the Qgis-developer
mailing list