[Qgis-developer] [Python] QgsFeatureIterator for geometryless PostgreSQL-Layer

Jürgen E. Fischer jef at norbit.de
Tue Apr 9 09:10:23 PDT 2013

Hi Bernhard,

On Tue, 09. Apr 2013 at 15:09:31 +0200, Bernhard Ströbl wrote:
> I am trying to access features of a geometryless layer derived from a  
> PostgreSQL table in current master.
> if I do
> feat = QgsFeature()
> iter = myLayer.getFeatures(QgsFeatureRequest().setFilterFid(myFid))
> iter.nextFeature(feat)
> returns False and I get a message in the PostgreSQL message tab stating  
> "Trying to fetch geometry on layer without geometry."
> Can anybody confirm?
> Do I miss anything or is this a bug?

You request geometry (by not saying you don't want any) - and get refused
because there's none.

myLayer.getFeatures(QgsFeatureRequest().setFilterFid(myFid).setFlags( QgsFeatureRequest.NoGeometry ) )

should work.  Not really a bug, but inconvienent.


Jürgen E. Fischer         norBIT GmbH               Tel. +49-4931-918175-31
Dipl.-Inf. (FH)           Rheinstraße 13            Fax. +49-4931-918175-50
Software Engineer         D-26506 Norden               http://www.norbit.de
committ(ed|ing) to Quantum GIS                         IRC: jef on FreeNode                         

norBIT Gesellschaft fuer Unternehmensberatung und Informationssysteme mbH
Rheinstrasse 13, 26506 Norden
GF: Jelto Buurman, HR: Amtsgericht Emden, HRB 5502

More information about the Qgis-developer mailing list