Opened 17 years ago
Closed 6 years ago
#1617 closed enhancement (wontfix)
adding parameter "bool preserveFIDs = true" to CopyLayer() and CopyDataSource()
Reported by: | Kosta | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | OGR_SF | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: |
Description
I would like to add an additional parameter:
bool preserveFIDs = true
to the methods CopyLayer() and CopyDataSource().
For example: I get in trouble, if I do a CopyLayer() into a MySQL data source and the FIDs of the source features do not increase from 1 to n (= feature count), due to the "AUTO_INCREMENT" spec of "OGR_FID" in the MySQL impl.
Patch attached...
Or this is a bug in the MySQL impl and explicitly setting the OGR_FID should be forbidden...
Attachments (1)
Change History (5)
by , 17 years ago
Attachment: | preserveFIDs.diff added |
---|
comment:1 by , 9 years ago
There is a -preserve_fid option in ogr2ogr
-preserve_fid: Use the FID of the source features instead of letting the output driver to automatically assign a new one.
Does it mean that the requested feature is implemented and ticket can be closed as fixed?
comment:2 by , 9 years ago
The ticket is probably at least partly outdated and I fear that the patch would not work anymore. RFC https://trac.osgeo.org/gdal/wiki/rfc46_gdal_ogr_unification says: "The CopyDataSource?() virtual method has been removed since no in-tree drivers implement it."
The CopyLayer() part may still be valid. http://www.gdal.org/gdal_8h.html#ab6af8f62727c70bc767086fc5c0daf9c tells that "The papszOptions argument can be used to control driver specific creation options. These options are normally documented in the format specific documentation." Thus preserveFIDs does not exist in CopyLayer. However, ogr2ogr has an option for that:
"-preserve_fid:
Use the FID of the source features instead of letting the output driver to automatically assign a new one. Note: starting with GDAL 2.0, if not in append mode, this behaviour becomes the default if the output driver has a FID layer creation option. In which case the name of the source FID column will be used and source feature IDs will be attempted to be preserved. This behaviour can be disabled by setting -unsetFid "
I can't judge if this ticket could be closed because it has been resolved in an alternative way or not.
comment:4 by , 6 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Probably no longer needed with the availability of GDALVectorTranslate()
patch for adding "bool preserveFIDs = true" to CopyLayer() and CopyDataSource()