Great Salvatore, you're right.
I thought the geometry wasn't passed by the iterator but it could be used
during  the request expression evaulation. That was wrong ;)

giovanni


2014-10-16 20:44 GMT+02:00 Salvatore Larosa <lrssv...@gmail.com>:

> Hi Giovanni,
>
> On Thu, Oct 16, 2014 at 7:45 PM, G. Allegri <gioha...@gmail.com> wrote:
> > I need to iterate over a layer without the need of geometries.
> > I rembember I used this flag time ago and it worked fine. Now, if I set
> this
> > on the feature request, I get an empty set of features from the
> iterator. Am
> > I doing something wrong?
> >
> > req = QgsFeatureRequest(QgsExpression('$area>1000,00'))
> > reg.setFlags(QgsFeatureRequest.NoGeometry)
> > feats = [f for f in mylayer.getFeatures(req)]
>
> if you set flag to NoGeometry you cannot pass the $area function as it
> needs of the geometry in order to calculate the correct value.
> your snippet should to work whether you store the value of $area in a
> new field and use it in your espression
>
> Could this be a reason? :)
>
> Ciao.
>
> --
> Salvatore Larosa
> linkedIn: http://linkedin.com/in/larosasalvatore
> twitter: @lrssvt
> skype: s.larosa
> IRC: lrssvt on freenode
>



-- 
Giovanni Allegri
http://about.me/giovanniallegri
Twitter: https://twitter.com/_giohappy_
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus
_______________________________________________
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-developer

Reply via email to