-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deleted/edited features within SHAPEFILE are still recognized in other software packages #19349
Comments
Author Name: Giovanni Manghi (@gioman) Hi Saber, is this a SAGA issue or a QGIS one? What happens if you do the same using native SAGA instead of Processing?
|
Author Name: Saber Razmjooei (@saberraz) Gio, I suppose it is a problem with SAGA. But will be to have it fixed upstream or work-around in QGIS. Otherwise, it might confuse users. |
Author Name: Victor Olaya (@volaya) This is really weird. If you have modified the shapefile and deleted data...how can SAGA know that there was a feature in there that now is missing?? If you have changed the shapefile, there is no way the deleted feature can be recovered. Maybe you are saving to a different file and then using the original to call SAGA? |
Author Name: Saber Razmjooei (@saberraz) Victor, I guess in QGIS, when you delete a feature in a shapefile, it does not physically delete that feature. It flags it as deleted but it is still there. The shapefile gets "cleaned" when you save as... |
Author Name: Giovanni Manghi (@gioman) Saber Razmjooei wrote:
Hi Saber, this does not seems to be the case. Delete a feature, save edits and load the shape in another QGIS window (or any other GIS package), the feature is not there. |
Author Name: Saber Razmjooei (@saberraz) Sorry Gio, that's correct. The bug only happens in active QGIS window, where editing took place. |
Author Name: Victor Olaya (@volaya) Saber Can you confirm the QGIS version you are using? I am finding that behaviour (deleted features that are actually not deleted in the shapefile, even after closing the edition), not just in Processing, but in QGIS in general. Taking the modified layer to a different software (as Processing does when passing the layer to SAGA) shows the deleted features. But I see this issue only in 2.4, not in 2.2. IF this is the case, then it's a QGIS issue and we should open another ticket. |
Author Name: Victor Olaya (@volaya) IT seems DBF files have a deleted flag (http://www.clicketyclick.dk/databases/xbase/format/dbf.html#DBF_NOTE_9_TARGET). SAGA might not recognise it, and probably the way QGIS was removing features before was just actually eliminating them, while now it sets that flag to deleted. That would explain the error. |
Author Name: Saber Razmjooei (@saberraz) Victor, it is in 2.4. As you said the problem is not limited only to the Processing. The deleted features appear in Vector > Geoprocessing results too. |
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Giovanni Manghi (@gioman)
|
Author Name: Giovanni Manghi (@gioman)
it affects also 2.2 and previous qgis releases (and master).
|
Author Name: Giovanni Manghi (@gioman) Saber Razmjooei wrote:
Hi Saber, while I confirm it affects also other software packages I cannot confirm that affects the own QGIS geoprocessing tools. See also #19680 |
Author Name: Saber Razmjooei (@saberraz) Gio, |
Author Name: Giovanni Manghi (@gioman) In #19680 there are example of software packages affected bu this issue, anyway SAGA it is also affected and it is easy to test as it comes with QGIS. A few notes: a) after deleting a feature using the shape as input for SAGA gives error: DBase file could not be opened. removing and re-adding the shape and running it against SAGA again works without errors, but the operation (ex: buffer) takes into account also the features that it should have been deleted b) using the node tool to edit a feature and using the shape as input in SAGA gives error: DBase file could not be opened. removing and re-adding the shape and running it against SAGA again works without errors and as expected c) using the reshape tool to edit a feature and using the shape as input in SAGA gives error: DBase file could not be opened. removing and re-adding the shape and running it against SAGA again works without errors, but the operation (ex: buffer) result is as it was run against the input before being edited in qgis. d) using the split features tool to edit a feature and using the shape as input in SAGA gives error: corrupted shapefile. removing and re-adding the shape does not help. It is not strictly a regression, but given the huge interoperability issues that this issue creates I would like to ask to raise this as blocker.
|
Author Name: Giovanni Manghi (@gioman) I made some tests with ArcGIS 10: a) delete a feature, save. Add the shape into arcgis, the deleted feature is there (both geometry and attribute). so this confirms (again) #19592 Using the shape as input in arcgis (ex: buffer) then the "phantom" feature is removed from input and output is as expected. doing operations as b) c) d) does not seems to have any bad effect when adding the shape in arcgis |
Author Name: Giovanni Manghi (@gioman) it is being very hard to find a clear pattern: there are shapes that when edited always causes SAGA (again, we are using SAGA in first place because it is easy available and works together with QGIS) to use also the edited/deleted features or to throw an error (error: corrupted shapefile). other sw packages seems affected also in the cases when SAGA it is not. the only thing that seems to work almost all the times is to re-save the shapefile as a copy. |
Author Name: Jukka Rahkonen (Jukka Rahkonen) I was reading this stackexchange question http://gis.stackexchange.com/questions/118689/cant-transform-lines-to-polygons with a sample data available for a few days now at http://dropcanvas.com/7i4oq. Ogrinfo summary: ogrinfo TesteLayer.shp -al -so Layer name: TesteLayer
|
Author Name: Giovanni Manghi (@gioman) Jukka Rahkonen wrote:
it is indeed a strange situation: another software, gvsig, reads the shape in a different way from qgis and openjump. Re-saving the shape with this sw the first returns a shape with 85 features Any software shows the same data when re-saving the shapefile with qgis or ogr2ogr (12 features). My guess is that the shape was edited (features deleted) with qgis, this we know now that leave the shape in a state that is inconsistent and gives unexpcted results in other software. If the shape is re-saved after the edits apparently something is used (a parameter in ogr2ogr?) and the vector gets a consistent state. |
Author Name: Matthias Kuhn (@m-kuhn) QGIS calls repack() which is supposed to clean the dbf whenever removing/unloading a layer from which features have been removed in the running QGIS session. You can test this behavior by deleting a feature from the test dataset mentioned above and then unloading the layer. The file size of the dbf decreases by a couple of kB. Calling repack() in a running QGIS session is dangerous because it changes feature ids. And QGIS (and its plugins) should be able to rely on feature ids being unchanged for the lifetime of a layer.
|
Author Name: Giovanni Manghi (@gioman) Matthias Kuhn wrote:
Hi Matthias, it is not (just) a SAGA issue, that would be the last of our problems. The issue is also with other very popular gis packages. Add a shape in qgis, edit it (delete,reshape,split,etc.), save edits. Remove the shape (or not) and open it in such software, the "phantom" features are there... cheers! |
Author Name: Matthias Kuhn (@m-kuhn) If you remove features in QGIS, close the project and open the shapefile in other software, the file should be clean. Is it not? Can you confirm that QGIS cleans the sample data from this report with the steps I outlined above:
|
Author Name: Giovanni Manghi (@gioman) Matthias Kuhn wrote:
cannot confirm, unloading the layer from project and/or closing qgis does not clean the shape. |
Author Name: Giovanni Manghi (@gioman)
re-saving it does. |
Author Name: Giovanni Manghi (@gioman) Matthias Kuhn wrote:
in my pc I can only test open source programs, but what you can see in the attached image happens also with closed source one. The shape was reshaped in qgis, saved, removed from project, closed qgis and opened in openjump.
|
Author Name: Matthias Kuhn (@m-kuhn) Cannot reproduce this here in this case. Just to be sure: you deleted a feature first, then you saved, then you removed the layer from the legend, correct (i.e. the deleting part is important, just because you didn't mention it in your comment)? After doing this here: INFO: Open of Layer name: TesteLayer |
Author Name: Giovanni Manghi (@gioman) Matthias Kuhn wrote:
notes from the many comments (also in duplicate tickets)
https://issues.qgis.org/attachments/7917/Test501_before_editing.zip is a good example to replicate the issues.
|
Author Name: Matthias Kuhn (@m-kuhn) I am using
And it always shows the correct feature count. For Test501 it's originally 2 (it's clean in the state when it's downloaded, right?) and subsequently it always reflects the correct number (tried to remove / split / split and remove). I don't know what I can do to try harder... :( |
Author Name: Saber Razmjooei (@saberraz) Matthias, Try the attached dataset (sample_data.zip). Tested in QGIS 2.4 and Master under windows 7 (OSGeo4W install)
|
Author Name: Saber Razmjooei (@saberraz)
Original Redmine Issue: 11007
Affected QGIS version: 2.8.5
Redmine category:data_provider/ogr
Assignee: Marco Hugentobler
When working with SAGA modules, it ignores "Delete flag" in shapefile and uses those deleted features within the processes.
To replicate the issue:
1- Open a shapefile
2- Delete a feature
3- Save the shapefile
4- Run a SAGA process on the shapefile
5- Result of the process takes into account the deleted feature, despite the fact that it has been deleted and saved.
Related issue(s): #17110 (relates), #17515 (relates), #18895 (relates), #18967 (relates), #19680 (relates), #20772 (relates), #21471 (relates), #21478 (duplicates), #21968 (duplicates), #22095 (relates), #22485 (duplicates), #23337 (relates)
Redmine related issue(s): 8317, 8822, 10483, 10560, 11398, 12660, 13422, 13431, 13953, 14085, 14512, 15407
The text was updated successfully, but these errors were encountered: