Bug report #10560
Wrong feature count after edit
Status: | Closed | ||
---|---|---|---|
Priority: | Severe/Regression | ||
Assignee: | - | ||
Category: | Data Provider/OGR | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | fixed/implemented |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 18967 |
Description
To reproduce:
- Open a vector layer
- Right-click on the layer from layer tree and enable Feature count (the number of features is correct at this stage)
- Toggle editing
- Add or delete features (number of features is still correct)
- Save edits
Feature count resets to the original number
The bug is not in 2.2
Related issues
Associated revisions
Fix #10560 (wrong feature count)
Repack shapefiles when saving after deleting features
- QgsVectorDataProvider::dataChanged() will be emitted
- QgsVectorLayer::dataChanged() will be emitted
- Clears QgsVectorLayerCache
- Reloads the attribute table
- Clears the selection
Looking forward to people complaining about their lost selection...
Fix #10560
Fix #11989
Refs #8317
Refs #8822
Refs #10483
Refs #11007
Refs #7540
Refs #11398
Refs #11296
History
#1 Updated by Martin Dobias over 10 years ago
- Assignee set to Martin Dobias
#2 Updated by Martin Dobias over 10 years ago
- Status changed from Open to Closed
Fixed in changeset f581e20c44d746590a9454f397218ebe501e6a9c.
#3 Updated by Steve Lowman almost 10 years ago
- Target version set to Version 2.6
- Status changed from Closed to Reopened
This bug is occurring in 2.6.
#4 Updated by Giovanni Manghi almost 10 years ago
- Affected QGIS version changed from 2.2.0 to 2.6.0
- Status changed from Reopened to Feedback
- Target version deleted (
Version 2.6)
Steve Lowman wrote:
This bug is occurring in 2.6.
cannot confirm on qgis master, please give it a try and report back.
#5 Updated by Nyall Dawson almost 10 years ago
I can confirm this on master, when editing a shapefile.
#6 Updated by Martin Dobias almost 10 years ago
- Assignee deleted (
Martin Dobias) - Status changed from Feedback to Open
#7 Updated by Jürgen Fischer almost 10 years ago
- Category set to Data Provider/OGR
#8 Updated by Saber Razmjooei over 9 years ago
- Status changed from Open to Closed
Works fine in 2.8.2.
#9 Updated by Steve Lowman over 9 years ago
- Status changed from Closed to Reopened
I tested it in 2.8.2. The bug still exists.
I paste a couple of copied features into the layer. The count changes from 0 to 2. All good so far.
I save the change. The count stays at 2. All correct still.
I delete one of the features. The count reduces to 1. Still good.
I save the change. The count changes back to 2. Oh dear, not so good.
#10 Updated by Giovanni Manghi over 9 years ago
- Affected QGIS version changed from 2.6.0 to master
- OS version deleted (
7) - Operating System deleted (
Windows)
#11 Updated by Matthias Kuhn over 9 years ago
Pull request ready.
https://github.com/qgis/QGIS/pull/2086
Most relevant discussion can be found in:
#11007
#12 Updated by Matthias Kuhn over 9 years ago
- Status changed from Reopened to Closed
Fixed in changeset 7d7cdcd376c0d3fa60af1403a91e1e611b210174.
#13 Updated by Steve Lowman over 8 years ago
- Status changed from Closed to Reopened
This bug is occurring again in 2.14.3. Feature count has been working fine for a while, but whatever the change that fixed it, it seems to have been reversed.
#14 Updated by R. R. over 8 years ago
Feature count for shape files seems to work properly here on Ubuntu 16.04 LTS (1:2.14.3+git20160529+7d7467f+24xenial). Can you provide a list of steps to reproduce the issue?
#15 Updated by Steve Lowman over 8 years ago
Yep, I'm in W10. How to reproduce this...
1. New project file.
2. New shapefile layer.
3. Check 'Show Feature Count' for new layer.
4. 'Add Features' tool, digitise some features, e.g. 2 features. (Feature Count updates correctly - reads '2').
5. Save Layer Edits. (Feature Count stays correct - reads '2').
6. Digitise one more feature, and save layer edits. (Feature Count still correct - reads '3').
7. Select and delete one of your features. (Feature Count reduces correctly - reads '2').
8. Save Layer Edits. (Feature Count incorrectly reverts to previous value - reads '3').
#16 Updated by R. R. over 8 years ago
- File 10560_qgis-2-14-3.mp4 added
Hi Steve, thanks for your reply. I can't confirm this issue on Ubuntu 16.04 LTS (see screencast).
#17 Updated by R. R. over 8 years ago
Steve Lowman wrote:
8. Save Layer Edits. (Feature Count incorrectly reverts to previous value - reads '3').
I can confirm this on Win7 (QGIS 2.14.3)!
Related: #14859 - Feature count issue (PostGIS view)
#18 Updated by Andreas Neumann over 8 years ago
- File qgis-rel-dev.png added
I just tested this with a shapefile on Windows 7 with QGIS 2.15 (master) and QGIS 2.14 (#843d17e ) and aren't able to reproduce this issue.
@Reinhard and/or Steve: can you please test with #843d17e - you can install it using the OSGeo4W installer (http://download.osgeo.org/osgeo4w/osgeo4w-setup-x86_64.exe) by chosing "QGIS Rel Dev" in the "Desktop" section.
#19 Updated by Giovanni Manghi over 8 years ago
- Status changed from Reopened to Feedback
#20 Updated by Giovanni Manghi over 8 years ago
- Status changed from Feedback to Closed
- Resolution set to fixed/implemented
this is very likely related to #11007
the issue has been solved in master and backported to the development branch of 2.14
#21 Updated by R. R. over 8 years ago
I've done the steps above in QGIS 2.15 master 600ff4f and 'Show Feature Count' works as expected.
(Win7)
#22 Updated by Ervin Wirth about 8 years ago
- Status changed from Closed to Reopened
- File qgisissue.png added
The problem still exist with 2.16.2 after removing some features with PyQGIS codelines and commit changes.
Windows 7 x64.
#23 Updated by Even Rouault about 8 years ago
- Status changed from Reopened to Feedback
@Ervin, could you provide a self contained script + dataset that reproduces the issue ?
#24 Updated by Matthias Kuhn about 8 years ago
- Status changed from Feedback to Closed
@Ervin, make sure you use the layer.add/remove/etcFeature() methods and not layer.dataProvider().add/remove/etcFeature() methods.
Will close this until someone can provide a script/data to reproduce.