[gdal-dev] FileGDB -preserve_fid

Even Rouault even.rouault at mines-paris.org
Thu Dec 13 10:55:42 PST 2012


Le jeudi 13 décembre 2012 09:56:14, Jeremy Palmer a écrit :
> > At first sight, I would say it is a limitation of the FileGDB API.
> > 
> > In FGdbLayer::CreateFeature( OGRFeature *poFeature ),
> > 
> > you can see the following commented code :
> >   /* Cannot write to FID field - it is managed by GDB*/
> >   
> >    //std::wstring wfield_name = StringToWString(m_strOIDFieldName);
> >    //hr = fgdb_row.SetInteger(wfield_name, poFeature->GetFID());
> > 
> > So there was an attempt made of preserving the FID, but apparently it
> > doesn't work.
> > 
> > Looking at Row.h in the FileGDB API include files, I can see that there's
> > a public GetOID() method, but SetOID() is private. So it seems that the
> > FileGDB API manages itself the OID.
> > 
> > Even
> 
> Thanks for the info. So what are the options to get the source FID data
> into FileGDB? I found if I remove the primary key from the Postgresql
> table that works. However this is a less than desirable option.

Try with a SQL statement that will rename the primary key into another name, 
for example : -sql "select *, ogc_fid as the_fid from poly"


More information about the gdal-dev mailing list