3

I have an issue with digitizing lines in QGIS 2.18.2. I was using cadtools and after digitizing lines in my Lines layer on saving i get the message:

--Could not commit changes to layer (insert layer name)

Errors: ERROR: 1 feature(s) not added - geometry type is not compatible with the current layer.--

I have digitized a line in a line layer - that is certain.

I have tested without using the Cadtools and it appears that even if i use the snapping tool to digitize to a feature it throws the above error but if i just digitize a random line not using snapping then it is able to save.

5
  • Small update. Digitizing appears to work fine in 2.14. Looks like it could be a compatibility issue Commented Jul 26, 2017 at 4:29
  • Current version is 2.18.11. Maybe the issue has been fixed in the meantime.
    – AndreJ
    Commented Jul 26, 2017 at 5:21
  • Tried using 2.18.10 No go. Will check out 2.18.11 - cheers all Commented Jul 26, 2017 at 6:23
  • There might be a difference between linestring and multilinestring. The second one will not go into a linestring layer. What filetype are you saving to?
    – AndreJ
    Commented Jul 26, 2017 at 6:56
  • Hey AndreJ - Shapefile. Commented Jul 27, 2017 at 4:32

2 Answers 2

3

I think you are hitting this bug. Basically, if you have a 3d point that you're line starting point is snapped to, that line becomes a LinestringZ instead of a Linestring. Of course, a LinestringZ cannot be saved in a Linestring column type so the error pops out. Under 2.14, the error is more explicit as it comes from the database side (if you're using Postgis):

PostGIS error while adding features: ERROR:  Geometry has Z dimension but column does not

Under 2.18 and Master, the error is caught by QGIS, under the error message from the question.

Here's a screenshot of the problem: enter image description here

Of course, the upper line doesn't get saved. You can see what happens by labeling your line layer with:

geom_to_wkt($geometry)
2

The bug report citied in the previous comment indicates that this problem is in the process of resolution. However for those who need a fix now (or in future without re-downloading QGIS) I have found a quick resolution/work-around. The problem does not occur if the first point of your vector layer is not snapped to a 3d vector layer (in my case I am creating a 2d polygon from 3d point data) because the first point dictates to QGIS whether the layer is 2d or 3d. So you can simply start your new vector feature with a point that is not snapped to the 3d point layer. Then after the first point you can start snapping to the 3d layer and QGIS will know you are only interested in the x and y coordinates. Once completed your feature should save as normal.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.