Le mercredi 19 octobre 2016 14:14:40, Chris Buckmaster a écrit :
> I have a geopackage polygon layer and I am trying to split a simple feature
> within it.
> When I try to do it, I get an error message 'failed to insert, UNIQUE
> constraint failed'.
> Is this a known issue with splitting features using the geopackage format,
> it could it be how the layer is set up?
No, it is due to the fact that when splitting the feature, the newly created
feature receives the same 'fid' value (the first column in the attribute table)
as the other part, and that when creating the feature, the fid, when set, is
honoured. Hence given the duplication of fid, the failure. Before saving the
edits, you can manually unset the fid.
Although something should probably be done either in the splitting tool to
unset the fid column of the new feature. Or perhaps the provider could be made
more tolerant in the case of duplicated FID to assign a new one.
This could happen for other formats handled by OGR like spatialite (if not
going throug the QGIS spatialite provider), FileGDB, etc...
Would probably deserve a ticket in the bug tracker.
Spatialys - Geospatial professional services
Qgis-user mailing list
List info: http://lists.osgeo.org/mailman/listinfo/qgis-user