Closed Rkalpoe closed 1 year ago
First let us know which QGIS version you're using and what is the data provider you're attempting to write to.
Any chance to send a subset of data for us to replicate the issue?
Thank you for getting back so quickly.
QGIS version: 3.26.3-Buenos Aires
What do you mean with data provider?
I have prepared and attached a subset as a QGIS project. Is that ok? You will find 2 groups with layers: Source and Target. For example, I tried to append the features of the source layer ''FIETSENREK_line'' into the target layer ''fietsenrek''. Also, ''ABRI_polygon'' should be appended into ''abri'' and ''Afvalbak_point'' into ''afvalbak''.
The original format of the two imported datasets is fileGeodatabase.
What do you mean with data provider?
It's the data format in QGIS jargon, so in this case: FileGDB.
I have prepared and attached a subset as a QGIS project. Is that ok?
You have sent the .qgz file, which is just the QGIS project, i.e., no data included. If you can send a subset of data, that would make things easier.
Allright, I see. Attached you find the two (source and target) fgdb's. 10-2-23.TestProject.zip
Apparently the FGDB format does not allow appending features to it. I get this message:
WARNING: The target layer does not support appending features to it! Choose another target layer.
Not sure if I have to do some driver configuration for FGDB or sth like that.
Which GDAL version are you using?
It would be strange, but according to this, there is an issue with old GDAL versions when creating a feature with a custom FID (that is true if you're using the FileGDB SDK API, i.e., FGB driver by esri): https://gdal.org/drivers/vector/filegdb.html#createfeature-support
My GDAL version is: GDAL 3.5.2, released 2022/09/02
So, what I discovered in the meantime is that the functionality works when the target layer contains at least one feature. Can you verify this by i.e. using the test cases below (like i did):
(1) you can append (in this case: duplicate) the features of a layer into the same layer (i.e. FIETSENREK_line). (2) you can create a new ''dummy'' feature in a target layer (i.e. fietsenrek) via ''add feature'' in the attribute table. Then, append the features of a source layer (i.e. FIETSENREK_line) into a target layer (i.e. fietsenrek) using the function. Finally, delete the ''dummy'' feature.
So it seems that when the target layer contains no features the function gives the error: Cannot call CreateFeature() with a set FID when a dataset is opened more than once.
Has this been a deliberate decision when developing the function?
If so, using test case two: How to reset the field Object ID in QGIS after deleting the ''dummy'' feature? Namely, it seems that by using the field calculator* (in the attribute tabel) to update the field, I cannot commit the changes to the layer. Or do you know another workaround?
*Using the solutions of: https://gis.stackexchange.com/questions/167991/how-to-copy-same-values-to-another-field-in-attribute-table-in-qgis-using-field or https://gis.stackexchange.com/questions/27739/filling-column-with-consecutive-numbers-in-qgis.
It seems this really depends on QGIS (GDAL) versions.
This is what I have installed: QGIS 3.28.3-Firenze
and this is what I get:
Solving the issue by (just) upgrading my QGIS version (to QGIS 3.28.3-Firenze) worked. I can append from all layers to all layers perfectly using the function.
Problem solved. Thank you for your time!
Great! Then let's close this issue.
The function ''Just APPEND all features, no matter of duplicates'' keeps giving me the error:
Layer ''layername'': OGR error creating feature -5018: Cannot call CreateFeature() with a set FID when a dataset is opened more than once.
How to solve this?