Bug report #16870
copy/paste/save fails ("geometry type is not compatible with the current layer") for a specific point dataset in qgis master (on Windows)
|Affected QGIS version:||master||Regression?:||Yes|
|Operating System:||Windows||Easy fix?:||Yes|
|Pull Request or Patch supplied:||Yes||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||24769|
Was all ok until 2.18.10 included.
To test just make a copy of the attached shapefile.
#2 Updated by Giovanni Manghi over 3 years ago
Richard Duivenvoorde wrote:
I cannot reproduce this?
In current master I:
- open your attached zip (without unzipping)
- select a bunch of points
- Paste as New Vector layer (in Edit menu)
- then I can save it both as shape file or geopackage without problem...
no, that is not the right workflow.
Open the shapefile > save as (shapefile) to make a clone of it > copy features from original shape > paste into copy > try save edits in copy
#4 Updated by Giovanni Manghi over 3 years ago
Jürgen Fischer wrote:
Not reproducable in master (insert above point layer, copy features from layer, save as other file, start editing saved layer, paste features to layer, commit changes, voila)
will post screencasts from both 2.18.10 nightly and master from clean testing environments.
#7 Updated by Giovanni Manghi over 3 years ago
Jürgen Fischer wrote:
Jürgen Fischer wrote:
and not with 2.18.10 (same procedure; both on Linux)
but with master on windows (with GDAL 2.2 vs. GDAL 2.1.2 on Linux)
test in clean env (Linux and Win) + screencast is coming (if confirmed)... just a few more minutes.
#8 Updated by Giovanni Manghi over 3 years ago
- Operating System set to Windows
- File Recording #2.mp4 added
- Subject changed from copy/paste/save fails ("geometry type is not compatible with the current layer") for a specific point dataset in qgis 2.18.10-nightly and master to copy/paste/save fails ("geometry type is not compatible with the current layer") for a specific point dataset in qgis master (on Windows)
- Affected QGIS version changed from 2.18.10 to master
I tried again on clean testing environments both linux and windows, with 2.18.10-nightly and master. And despite not confirming again on 2.18.10-nightly and master on linux, I still see it on master Windows. That is on a clean Win7 VM, with qgis master just installed from osgeo4w. Screencast attached.
#12 Updated by Luigi Pirelli over 3 years ago
independent by provider type (tested on spatialite)
the check is done because it is wkbPoint or wkbPoint25D as in:
#13 Updated by Luigi Pirelli over 3 years ago
btw on Linux (compild master) the line:
that generate the erro ris never reached because the pasted geometry has the same type of destination layer.
Something different happend in Windows... could be a erroneous geometry due to cut&paste, or some missing gemetry type. More investigation. The hard is to have a debug setup on win.
#17 Updated by Giovanni Manghi about 3 years ago
Gerhard Spieles wrote:
I test it with 2.18.11 under win10 and win7.
Copy and paste between shape/shape and shape/spatialite is ok.
I haven`t test it with dxf/geopackage.
the question is if you tested the point layer attached to this ticket. In general it works, but there are datasets where it does not.
#20 Updated by Luigi Pirelli about 3 years ago
new debug message... for some reason one geometry pasted has been converted to PointZM (3001) instead of Point (1)
2017-08-05T04:13:22 WARNING ID -2906 has geom 1 of type 1
2017-08-05T04:13:22 WARNING ID -2905 has geom 1 of type 1
2017-08-05T04:13:22 WARNING ID -2904 has geom 1 of type 3001
#22 Updated by Luigi Pirelli about 3 years ago
the erro is derived from the fact that in: https://github.com/qgis/QGIS/blob/master/src/app/qgsclipboard.cpp#L194 to the generator is passed a record with WKT + all attached params.
If a params has a value with "( ... )" the QgsGeometry::fromWkt(string) return a wrong geometry
#24 Updated by Luigi Pirelli about 3 years ago
in windows for a not clear to me combination setting value of mUseSystemClipboard enter in:
where the geometry os build getting the WKT string + fields values.
If a field value has (something) e.g. "POINT value1 value2 aaa(something) value3"
then the geometry is PointZM generated by QgsGeometry::fromWkt.
the error is that row have to be cleaned from fields values... that is the object of the patch I'm preparing.
#30 Updated by Luigi Pirelli about 3 years ago
reading the code probably the issue would affect also 2.18 in case of cut&paste from outside qgis, e.g. passsing from a dump of the layer in textual from from clipboard (in case of inter layer cut&paste, qgis use directly the features without text conversion). The fix is identical of the master code. I will backport to 2.18 as soon as possibile. BTW, please attache the complete layer to reproduce the issue.
In the description pelase also give the followiong informations:
1) configuration value of Option->settings-Zdata source->Copy feature as
2) detailed and reproducible sequence of steps to replicate the issue on 2.18.11
#32 Updated by Luigi Pirelli about 3 years ago
Applied in changeset qgis|2712f66938546f7423bc46a9376fe4c7a02c0505.
dbf file is especially important because the error was due to parse QgsGeometry::fromWkt from a WKT with attached all attributes and where an attribute has "(some value) inside.
btw https://github.com/qgis/QGIS/pull/5030 should have fixed it