[Qgis-developer] non integer ID and python

Jürgen E. Fischer jef at norbit.de
Tue Feb 26 22:52:24 PST 2013


Hi Denis,

On Wed, 27. Feb 2013 at 07:27:49 +0100, Denis Rouzaud wrote:
> I have a small problem in my quickfinder plugin (finds a feature by its id).

I don't know that plugin.  What does it actually do?


> For postgis layers, I have no problem to find a feature using its id.  
> But, I can't achieve this with shapefiles for example.

Shapefiles don't have a attribute for the the id.   The feature id is simply
the index of the feature in the file.  In QgsExpressions you can use "$id" to
reference the id (also works for postgis) - if that's what's you're after.

Otherwise feeture ids are always integers -  so you can use QgsFeature::id() to
get the id of a feature and use QgsFeatureRequest::setFilterFid() to retrieve a
feature by id.


Jürgen 

-- 
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