[Qgis-user] FileGDB: missing FID column

Even Rouault even.rouault at spatialys.com
Wed Dec 16 09:13:47 PST 2015


Le mercredi 16 décembre 2015 14:04:51, Thomas Schüttenberg a écrit :
> Hi!
> 
> please can anybody tell me why the FID column of a fileGDB-Layer is ignored
> and not shown in QGIS?
> 
> I added a fileGDB via add vector layer>directory>type OpenFileGDB or
> ESRI-FileGDB and everything works fine and fast.
> But when looking at the attribute table or the layer propeties the column
> "objectid" is not there although it is part of the data (see ogrinfo
> below). I tested this with 2.8.4 and 2.12.1
> 
> The actual reason to fumble with the FileGDB is, that i want to transfer
> this data to my PG. In this import process (e.g. OGR processing "Import
> Vector into PostGIS database") however the FID column is also ignored.
> A (new) FID/PK-column, that can be created during import is always filled
> with fresh serial values - not the original IDs from the data source -even
> when their name are the same.
> 
> The only way I see to solve / by-pass this (in my use case) is to duplicate
> the objectids to a new, seperate field befor doing the ogr-import.
> 
> But maybe some of you could suggest a better solution (and save me from the
> manual table-editing-pain? ;-)

Thomas,

ogr2ogr with the -preserve_fid option should do it. (This is the default 
behaviour in GDAL 2.0 when the target datasource, like PostgreSQL, has a FID 
layer creation option)

Even

-- 
Spatialys - Geospatial professional services
http://www.spatialys.com



More information about the Qgis-user mailing list