[Qgis-developer] featureAtId Python

bernhard.stroebl at jena.de bernhard.stroebl at jena.de
Fri Jul 8 04:33:59 EDT 2011


Found the solution myself. I indeed missed something (rtfm :) One has to 
set the fetchGeometries flag to False, like this:
 >>> l.featureAtId(571,f,False)
True

all the best

Bernhard

Am 08.07.2011 09:17, schrieb bernhard.stroebl at jena.de:
> Dear All,
>
> I am trying to access features from a geometryless PostgreSQL-Table by
> their id, same code works with geometry-containing (PostGIS) layers.
> In the Python-console enter:
>  >>> l=qgis.utils.iface.activeLayer() #geometryless table
>  >>> f=QgsFeature()
>  >>> l.featureAtId(571,f) #this id exists in the table
> False
>
> I tried on WinXP and Linux with QGIS 1.7.0
>
> Am I missing something or shall I file a ticket?
>
> regards
>
> Bernhard
>
> P.S.
> This works:
>  >>> l.select(571)
>  >>> l.selectedFeatureCount()
> 1
>
>
>
>
> ________ Information from NOD32 ________
> This message was checked by NOD32 Antivirus System for Linux Mail Server.
> http://www.nod32.com
> _______________________________________________
> Qgis-developer mailing list
> Qgis-developer at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-developer
>
>
> ________ Information from NOD32 ________
> This message was checked by NOD32 Antivirus System for Linux Mail Server.
> http://www.nod32.com

-- 
Bernhard Ströbl
Anwendungsbetreuer GIS

Kommunale Immobilien Jena
Am Anger 26
07743 Jena

Tel.: 03641 49- 5190
E-Mail: bernhard.stroebl at jena.de
Internet: www.kij.de



Kommunale Immobilien Jena
Eigenbetrieb der Stadt Jena
Werkleiter: Thomas Dirkes


________ Information from NOD32 ________
This message was checked by NOD32 Antivirus System for Linux Mail Server.
http://www.nod32.com


More information about the Qgis-developer mailing list