Bug report #19708
Processing: Join attributes by location produces duplicated fid
Status: | Closed | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | Processing/QGIS | ||
Affected QGIS version: | 3.2.2 | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 27533 |
Description
Here's how to reproduce the bug:
1. Add the 2 layers (pol1 and pol2) from the attached GeoPackage
2. In Processing, open Join attributes by location
3. Input layer: pol1; join layer: pol2; geometric predicate: within
4. Don't specify an output file (use a temporary layer)
5. The resulting layer will have 2 features with the same fid, and hence can't be saved to a new GeoPackage without manually editing the fid values
6. If you save directly to a GeoPackage (instead of using a temporary layer), one feature will be lost. Suprisingly, this doesn't happen if you save directly to a Shapefile
I know it is uncommon to use a spatial join with perfectly overlapping geometries in the joined layer, but it would be nice to have a consistent behaviour between different output formats.
Related issues
Associated revisions
Regenerate fids for "join attributes by location"
Fix #19708
Regenerate fids for "join attributes by location"
Fix #19708
History
#1 Updated by Jérôme Guélat over 6 years ago
Note that something similar happens with the Intersection algorithm (and maybe with other algorithms based on overlays).
#2 Updated by Giovanni Manghi over 6 years ago
- Operating System deleted (
Windows 7)
Confirmed here. I think that especially the result of the operation 6 ("If you save directly to a GeoPackage (instead of using a temporary layer), one feature will be lost") is particularly problematic.
#3 Updated by Jérôme Guélat over 6 years ago
After further testing, this also applies when the geometries are not perfectly overlapping (use intersect instead of within as a geometric predicate)... The problem happens when one feature from the input layer has at least 2 intersecting features in the join layer (and we perform a one-to-many spatial join).
See also #19758
#4 Updated by Andrea Giudiceandrea about 6 years ago
- Related to Bug report #19758: Processing: merge vector layers produces duplicated fid added
#5 Updated by Andrea Giudiceandrea about 6 years ago
- Related to Bug report #19998: Cannot export output of 'Points along geometry' tool as Geopackage added
#6 Updated by Matthias Kuhn about 6 years ago
- Status changed from Open to In Progress
#7 Updated by Anonymous about 6 years ago
- % Done changed from 0 to 100
- Status changed from In Progress to Closed
Applied in changeset qgis|f8d873c7cb44adada2ab38a5f1dad6a96adf8e14.