Bug report #13256

Shapefile corrupted on edit

Added by Spencer Gardner over 8 years ago. Updated over 8 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:-
Affected QGIS version:2.10.1 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:No Copied to github as #:21317

Description

I'm seeing some strange behavior on a shapefile I'm working with. If I draw a polygon in just the right spot and then save my edits, the polygon disappears. Any subsequent polygons that I draw and commit have the same problem. If I close QGIS, restart, and then add the same shapefile, the shape that I drew is visible, but seems to have issues. I can't always select it with the selection tool, for example.

I initially thought the issue might be that I was drawing shapes that were partially outside of the extents of the coordinate system of the projection on the shapefile, but if I draw other shapes far away from the other features and outside of the projection extents they draw and commit without problems.

A version of the shapefile that seems to be causing the problem is attached.

Steps to reproduce:
1 - Add test.shp to empty canvas
2 - Start edit session
3 - Draw new polygon at approximately the following coordinates (+/- 1,000 ft):
255902, 513277
415154, 514104
411018, 718443
290234, 698175
4 - Save edits

What happens:
Newly drawn polygon disappears. Shapefile is corrupted in some way. No errors to indicate that there was a problem.

What should happen:
Changes are rolled back and an error message is produced. Even better, QGIS handles whatever issue and the shape is committed as drawn.

test.zip (87.1 KB) Spencer Gardner, 2015-08-24 01:37 PM

overlap.PNG (33.8 KB) Saber Razmjooei, 2015-09-13 05:24 AM

History

#1 Updated by Saber Razmjooei over 8 years ago

  • File overlap.PNG added
  • Status changed from Open to Feedback

QGIS doesn't seem to handle vectors with overlapping features properly and throws out some random errors when editing them.
Feature 4 and 10 in your shapefile contains some overlapping.

Could you remove those features and try again? Also, worth trying in QGIS master.

#2 Updated by Spencer Gardner over 8 years ago

OK. More weirdness. When I delete features 4 and 10, commit edits, turn off editing, and then zoom, all features in the shapefile disappear. If I close QGIS, reopen, and add the modified shapefile to the canvas, I can see the features until I zoom again at which point they disappear. Same behavior in the latest nightly.

#3 Updated by Spencer Gardner over 8 years ago

Additional request: Can we mark this for causing corruption?

#4 Updated by Spencer Gardner over 8 years ago

Additional testing: I imported the shapefile to a PostGIS database and was unable to recreate the problem. It appears to be isolated to shapefiles.

#5 Updated by Saber Razmjooei over 8 years ago

Could you also save it as new shapefile and test?

#6 Updated by Spencer Gardner over 8 years ago

I saved test.shp as test2.shp and then deleted features 4 and 10. The issue does not occur on test2.shp.

#7 Updated by Saber Razmjooei over 8 years ago

Could be related to this #13297

#8 Updated by Spencer Gardner over 8 years ago

  • Status changed from Feedback to Closed

Thanks. Looks like this is part of the issue reported at #11007 (also connected with the issue linked above).

Also available in: Atom PDF