0

I have two issues, one related to saving edits on a vector layer, the other related to the visibility of layers, and I'm assuming they have the same root cause, so I'm posting it as a single question. I think the issue arises at the project level, rather than the specific layer.

I have a complex QGIS 3 project with many layers. Recently I was editing a small hand-drawn vector path shapefile [EDIT: Actually it's a KML] (called Scouting_and_plans) and when I went to save edits I got this error:

Could not commit changes to layer Scouting_and_plans

Errors: ERROR: 1 geometries not changed.

Provider errors: OGR error setting feature 41

I haven't found an explanation by Googling OGR error 41. I do seem to be able to edit some other vector layers in the project and save them normally.

As an attempted work-around, I exported the layer as a new layer. I tried both going to a new shapefile and a new geojson. In either case, I get what appears to be a layer with the appropriate data (attributes table works fine - also I can use the field calculator to get reasonable results), but there is no visible path. The path is not visible in the layers view on the left, nor on the actual map view, however if I edit the properties of the layer, all the settings appear normal - 100% opacity, some colored line with a reasonable stroke width.

I can still select paths normally, and the yellow selection color is applied - so the path is visible if selected. I can copy and paste a path to a new layer, and it is similarly selectable, highlightable, but not normally visible in the new layer.

If I create an empty project and add either the layer with the original issue, or the newly made layers, it functions normally, including for editing.

I have also opened the geojson file and looked at it in a text editor, and it appears normal.

I've re-loaded the project and restarted QGIS and the problem persists.

enter image description here The feature I can edit but which returns an error when I save is in red (I moused over it with the vector editing tool for this screenshot to make it obvious.)

Hig
  • 19
  • 4
  • I think the error means there is a problem with feature 41 rather than error code 41. Can you add a screen shot of the edit you are making? – Ian Turton Feb 19 '21 at 10:53
  • I see what you mean - also I just figured out the source file for this layer is a KML, not a shapefile as I said in my original post. So maybe it's an issue related to QGIS3's handling of KMLs, since I usually don't use this format. This post seems to suggest the sort of simple editing I'm doing should be possible, and the problem is saving not editing... https://gis.stackexchange.com/questions/84133/edit-kml-with-the-mouse-in-qgis-is-it-possible – Hig Feb 20 '21 at 08:45
  • 2
    As far as I know KML files are not editable in QGIS. Save to another format such as shapefile to enable editing. – Techie_Gus Feb 20 '21 at 09:44
  • It is editable, however the edits can't be saved. – Hig Feb 20 '21 at 21:00

1 Answers1

1

I think I have figured out that these problems both stem from how QGIS3 handles KML layers.

Ian Turton helpfully pointed out that the error is with feature 41, it's not error 41.

I discovered the layer I was editing was a KML rather than a shapefile, which I hadn't previously realized. I tried adding another KML and doing the same thing, and had the same result. Note that there is no problem editing the layer, it's just not possible to save those edits.

Additionally, the KML was displayed with a style where the layer is 100% opaque (under layer rendering), but the color is fully transparent (Opacity between units and color for the stroke.) I suspect that somehow this became the default style, and since QGIS3 doesn't read KML styles, it assigned that default style.

Hig
  • 19
  • 4