[gdal-dev] Coding for appending to a database in OGR

Peter J Halls P.Halls at york.ac.uk
Thu Oct 28 04:56:33 EDT 2010


Dear Team,

     I've reviewed the change log for release 8 so far and do not think that 
this question is version specific.

     I'm coding to support an incremental process for loading a large spatial 
database from a set of distribution objects.  I have noted that my present 
approach results in the OGR_FID column values restarting at 1 for each append. 
This is clearly an error!  However, there does not appear to be a method for 
initialising the 'nextfidtowrite' value in the API.  What is the best strategy 
to adopt?

     So far as I can see, there appear to be two options.  One is to read every 
feature until there are no more to read: I'd rather not do that.  The other 
would involve opening the layer, reading the featurecount and then requesting 
the featurecount'th feature - featurecount'th + 1 should give an error.  Both 
methods should leave the current feature being the last existing feature, but is 
this sufficient to effectively initialise the value at which the next FID will 
start?

Thanks and best wishes,

Peter

--------------------------------------------------------------------------------
Peter J Halls, GIS Advisor, University of York
Telephone: 01904 323806     Fax: 01904 323740
Snail mail: IT Services, University of York, Heslington, York YO10 5DD
This message has the status of a private and personal communication
--------------------------------------------------------------------------------


More information about the gdal-dev mailing list