Bug report #16948
"Paste features as..." always creates vector layer/scratch layer that can only handle just singlepart features, so pasting multipart features always returns an error
Status: | Closed | ||
---|---|---|---|
Priority: | High | ||
Assignee: | Luigi Pirelli | ||
Category: | Vectors | ||
Affected QGIS version: | 2.18.13 | Regression?: | Yes |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | Yes | Resolution: | fixed/implemented |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 24847 |
Description
Unlike the
Layer > create layer > new temporary scratch layer
dialog that allow the user choose if the supported geometries are multi or not, the
Paste features as...
dialog do not allow choose that, it turns that is the copied features are multi then an error in thrown... but not in the message bar as eventually expected, just in the log:
2017-08-01T14:01:14 1 Commit errors:
ERROR: 99 feature(s) not added - geometry type is not compatible with the current layer.
SUCCESS: 6 attribute(s) added.
2017-08-01T17:39:22 1 Commit errors:
ERROR: 62 feature(s) not added - geometry type is not compatible with the current layer.
SUCCESS: 6 attribute(s) added.
and the scratch layer does not even show in the layer list.
Related issues
History
#1 Updated by Gerhard Spieles over 7 years ago
Here no problem in 2.18.11 under win10
pdf is attached
#2 Updated by Nyall Dawson over 7 years ago
- Status changed from Open to Feedback
Giovanni - do you think we should just force the scratch layer to always be multitype here?
#3 Updated by Jürgen Fischer over 7 years ago
- Related to Bug report #16770: copy/paste/save features from one layer to another of the same time broke in 2.18 added
#4 Updated by Giovanni Manghi over 7 years ago
- Regression? changed from No to Yes
- File cn36201_caop_utm_wg84.dxf added
- Status changed from Feedback to Open
- Priority changed from Normal to High
Nyall Dawson wrote:
Giovanni - do you think we should just force the scratch layer to always be multitype here?
yes, possibly. Please note that this was working as expected in 2.14. The test can be done with the attached dxf, from where to copy the features.
#5 Updated by Luigi Pirelli over 7 years ago
something managed (convert to multi) in some provider or wkb cases:
https://github.com/qgis/QGIS/blob/master/src/app/qgisapp.cpp#L8021
#6 Updated by Gregor Sanders about 7 years ago
I'm trying to paste 98 polygons (some will be multipart) into a temporary scratch layer and they paste successfully, but I cannot save (QGIS v 2.18.12):
Errors: ERROR: 98 feature(s) not added - geometry type is not compatible with the current layer.
Giovanni wrote:
Nyall Dawson wrote:
Giovanni - do you think we should just force the scratch layer to always be multitype here?
yes, possibly. Please note that this was working as expected in 2.14. The test can be done with the attached dxf, from where to copy the features.
Note: In my case, the scratch layer was created as a multipolygon type layer, so maybe the problem is due to mixing single part and multipart polygons when pasting?
#7 Updated by Luigi Pirelli about 7 years ago
.
#8 Updated by Luigi Pirelli about 7 years ago
Hi Gregor,
what is the target format on which you want to save the scratch layer?
Gregor Sanders wrote:
I'm trying to paste 98 polygons (some will be multipart) into a temporary scratch layer and they paste successfully, but I cannot save (QGIS v 2.18.12):
Errors: ERROR: 98 feature(s) not added - geometry type is not compatible with the current layer.
Giovanni wrote:
Nyall Dawson wrote:
Giovanni - do you think we should just force the scratch layer to always be multitype here?
yes, possibly. Please note that this was working as expected in 2.14. The test can be done with the attached dxf, from where to copy the features.
Note: In my case, the scratch layer was created as a multipolygon type layer, so maybe the problem is due to mixing single part and multipart polygons when pasting?
#9 Updated by Luigi Pirelli about 7 years ago
- Assignee set to Luigi Pirelli
probably just adding a GUI to ask destination type (e.g. force to multy)
https://github.com/qgis/QGIS/blob/master/src/app/qgisapp.cpp#L8068
tha actual code that create scratch layer force to Multi in there is at least a feature multi inside the features to paste. I would leave the decision to convert to multy to the user
#10 Updated by Luigi Pirelli about 7 years ago
We should divide the problem in two aspects:
1) create a scratch layer asking the user to force
2) notify as soon as possible the user that paste is not compatible trying to avoid to wait to commitChanges to raise the exception.
#11 Updated by Luigi Pirelli about 7 years ago
I can't (almost) rplicate the issue with 2.18 36e6bd1
"almost" because, coping from a MultiLineString layer with real multi lines and choosing "automatic" in the "PasteAs" interface give the following results:
1) Memory layer => generate MultiLineString
2) Shapefile => generate LineString (but the multi line is accepted and present in the layer :/ )
3) Spatialite => generate MultiLineString
Probably Shapefile works (ogr) because it doen't do any strict geometry check
so, IMHO this issue can be closed, or I don't understand where is the issue.
@giovanni any opinion?
#12 Updated by Giovanni Manghi about 7 years ago
- Affected QGIS version changed from 2.18.11 to 2.18.13
Luigi Pirelli wrote:
I can't (almost) rplicate the issue with 2.18 36e6bd1
"almost" because, coping from a MultiLineString layer with real multi lines and choosing "automatic" in the "PasteAs" interface give the following results:
1) Memory layer => generate MultiLineString
2) Shapefile => generate LineString (but the multi line is accepted and present in the layer :/ )
3) Spatialite => generate MultiLineStringProbably Shapefile works (ogr) because it doen't do any strict geometry check
so, IMHO this issue can be closed, or I don't understand where is the issue.
@giovanni any opinion?
On 2.18.13 the behavior is still the same (wrong/error, works in 2.14):
2017-09-21T10:12:27 1 Commit errors:
ERROR: 418 feature(s) not added - geometry type is not compatible with the current layer.
SUCCESS: 6 attribute(s) added.
To replicate do exactly what in the description and with attached data.
#13 Updated by Luigi Pirelli about 7 years ago
confirmed following these steps
1) load attached dx: LineString layer
2) selct all features
3) past as new scratch layer => error in General log message. No message to the user via GUI
#14 Updated by Luigi Pirelli about 7 years ago
The PR: https://github.com/qgis/QGIS/pull/5223
seems solving the issue, please confirm
#15 Updated by Luigi Pirelli about 7 years ago
IMHO the patch does not solve the origin of the proble.... the LineString dxf layer is a LineStringZ
Any Z or M layer is Flat during paste:
https://github.com/qgis/QGIS/blob/release-2_18/src/app/qgisapp.cpp#L7625
I suppose because when new geometry engine was introduced it was necessary to avoid regressions.
#16 Updated by Luigi Pirelli about 7 years ago
IMHO any changes to accept Z or M layers have to be applied only in 3.x version
#17 Updated by Giovanni Manghi about 7 years ago
Luigi Pirelli wrote:
The PR: https://github.com/qgis/QGIS/pull/5223
seems solving the issue, please confirm
seems so, thanks!
#18 Updated by Luigi Pirelli about 7 years ago
- Pull Request or Patch supplied changed from No to Yes
- Status changed from Open to Closed
- Resolution set to fixed/implemented
Applied in changeset qgis|d3d8f4dd437f132cd6f73831d845f6b7286e2d30.