3

I often get an ogr error when I try to save a shapefile after working on it in Qgis ( adding features, removing, modifying attributes.. )

The error says :
"OGR ERROR : Attempt to delete shape with feature id (-28 ) which does not exist"

Does anyone have an idea about the reason why I'm getting this error and/or how to avoid it ?

2 Answers 2

4

I think you will not get this error if you Save between adding and removing features.

4
  • 1
    Thanks for the answer, using save between each operation may solve the problem but when working with a large number of features and a considerable amount of operation it becomes "annoying" to have to save changes to the shapefile after each action!
    – QgisTn
    Dec 13, 2012 at 13:33
  • 3
    Ok, then try the 'Save' always before deleting anything. Until you save, the features are only stored in memory, with negative ID. 'Save' might try to save and delete them in one step, which causes the error message. Same goes to adding and deleting table columns.
    – AndreJ
    Dec 13, 2012 at 13:48
  • Yes unfortunately QGIS + Shapefiles does not queue transactions very well at all and as such, its most likely a 'delete > add' action on the same record ID or something similar as mentioned above......., and yer, it just doesn't like that. If you are working with a large number of features and larger numbers of edits, then I would also suggest moving away from shapefiles and implement a database, which can handle transactions better.
    – nr_aus
    Nov 10, 2020 at 7:39
  • For that reason, QGIS favours geopackages as the standard format by now. The question is about 8 years old now!
    – AndreJ
    Nov 13, 2020 at 10:30
-1

Try the fix geometries tool - it fixed a persistent 'OGR [3] error1' error for me

1
  • 2
    Welcome to GIS.se! Please click 'edit' and update your post with more information about how to apply the fix geometries tool - how it works (command line? Example?) and what it can fix.
    – Simbamangu
    Nov 10, 2020 at 7:37

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.