[Qgis-developer] QgsFeatureRequest.setSubestOfAttributes(etc.) return all the fields

G. Allegri giohappy at gmail.com
Wed Dec 4 10:12:38 PST 2013


It seems that joining filters do not work (at leat in Python). I have to do:

request = QgsFeatureRequest(bbox)
request = request.setSubestOfAttributes(['id'],mylayer.pendingFields())

And I see that field names are always returned but field values are set to
None if filtered out.

giovanni



2013/12/4 G. Allegri <giohappy at gmail.com>

> errata corrige:
>
> (...)
> for field in feat.fields():
>        print field.name()
> (...)
>
>
>
> 2013/12/4 G. Allegri <giohappy at gmail.com>
>
> Probably I'm not using it correctly.
>> I want to retrieve the features within a bbox and obtain one field only.
>> Im' doing the following:
>>
>> request
>> = QgsFeatureRequest(bbox).setSubestOfAttributes(['id'],mylayer.pendingFields())
>> for feat in mylayer.geFeatures(request):
>>    for fields in feat.fields():
>>        print field.name()
>>
>> and I get all the field names printed while I thought I would get only
>> 'id'.
>> What am I doing wrong?
>>
>> giovanni
>>
>> --
>> Giovanni Allegri
>> http://about.me/giovanniallegri
>> blog: http://blog.spaziogis.it
>> GEO+ geomatica in Italia http://bit.ly/GEOplus
>>
>
>
>
> --
> Giovanni Allegri
> http://about.me/giovanniallegri
> blog: http://blog.spaziogis.it
> GEO+ geomatica in Italia http://bit.ly/GEOplus
>



-- 
Giovanni Allegri
http://about.me/giovanniallegri
blog: http://blog.spaziogis.it
GEO+ geomatica in Italia http://bit.ly/GEOplus
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20131204/1fd0d312/attachment-0001.html>


More information about the Qgis-developer mailing list