Bug report #10961

Edited Shapefile is written after closing QGIS

Added by Axel Schaefer over 10 years ago. Updated over 10 years ago.

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

Description

QGIS seems to write something into the shapefile after closing QGIS or creating a new project.

Steps to reproduce:

  • Create simple polygon shapefile.
  • Edit something
  • Save edits and leave the edit mode.
  • List content of directory where shapefile resides and check the time of the last change of the *.dbf, *.shp and the *.shx file.
  • Wait at least one minute
  • Close QGIS
  • List content of directory where shapefile resides and check the time of the last change of the *.dbf, *.shp and the *.shx file.

You'll notice that the *.dbf, *.shp and *.shx file have a newer modified than the rest.

Below are examples of my files. The first edit was at 13:21. I have saved my edits and quitted QGIS in the meantime and opened the project again afterwards.

The last edit was finished at 14:35. I saved the edits and left the editing mode (toggle edit).

myuser@mylinux:~/Geodata/shape$ ll poly01.*
-rw-rw-r-- 1 myuser myuser    5 Jul 28 13:21 poly01.cpg
-rw-rw-r-- 1 myuser myuser  552 Jul 28 14:35 poly01.dbf
-rw-rw-r-- 1 myuser myuser  388 Jul 28 13:21 poly01.prj
-rw-rw-r-- 1 myuser myuser  656 Jul 28 13:21 poly01.qpj
-rw-rw-r-- 1 myuser myuser 1244 Jul 28 14:35 poly01.shp
-rw-rw-r-- 1 myuser myuser  140 Jul 28 14:35 poly01.shx
myuser@mylinux:~/Geodata/shape$

I quit QGIS. I don't save the project. No other dialog occurs. The files after closing: the *.dbf, *.shp and *.shx file are modified (14:36).

myuser@mylinux:~/Geodata/shape$ ll poly01.*
-rw-rw-r-- 1 myuser myuser    5 Jul 28 13:21 poly01.cpg
-rw-rw-r-- 1 myuser myuser  552 Jul 28 14:36 poly01.dbf
-rw-rw-r-- 1 myuser myuser  388 Jul 28 13:21 poly01.prj
-rw-rw-r-- 1 myuser myuser  656 Jul 28 13:21 poly01.qpj
-rw-rw-r-- 1 myuser myuser 1244 Jul 28 14:36 poly01.shp
-rw-rw-r-- 1 myuser myuser  140 Jul 28 14:36 poly01.shx
myuser@mylinux:~/Geodata/shape$ 

In combination with my workflow (write the Shapefile into PostGIS database), I cannot use the Shapefile until the QGIS project or QGIS itself is closed. The Shapefile doesn't reflect all editing changes when I only save the editing changes and leave the edit mode. I have to close the program (or close the project). Therefore this issue has an impact on using the files.

Version information:

QGIS-Version    2.4.0-Chugiak
QGIS-Codeversion    exported
Kompiliert gegen Qt    4.8.6
Laufendes Qt    4.8.6
Kompiliert mit GDAL/OGR    1.10.1
Läuft mit GDAL/OGR    1.10.1
Kompiliert mit GEOS    3.4.2-CAPI-1.8.2
Läuft mit GEOS    3.4.2-CAPI-1.8.2 r3921
PostgreSQL-Client-Version    9.3.4
SpatiaLite-Version    4.1.1
QWT-Version    5.2.3
PROJ.4-Version    480
QScintilla2-Version    

Thanks and best regards,
Axel

History

#1 Updated by Giovanni Manghi over 10 years ago

  • Status changed from Open to Feedback

don't know if it answer partially to your question, but when you edit an existing shapefile usually the prj,qpj,cpg files do not change at all.

#2 Updated by Axel Schaefer over 10 years ago

Giovanni Manghi wrote:

don't know if it answer partially to your question, but when you edit an existing shapefile usually the prj,qpj,cpg files do not change at all.

That is right. The prj and qgj file contains the projection information and the cpg file the encoding (UTF-8). They are created when I create the shapefile. In this case I have created a new shapefile (poly01) for testing at 13:21.

#3 Updated by Matthias Kuhn over 10 years ago

I suppose it's because REPACK is called when the layer is unloaded.
This cleans up shapes marked for deletion and cannot be done while the layer is in use because the feature ids change when this call is issued.

What exactly is the problem with this?

#4 Updated by Axel Schaefer over 10 years ago

Matthias Kuhn wrote:

What exactly is the problem with this?

Thanks for the explanation. My workflow: I change a shapefile in QGIS. After saving I use a GeoKettle workflow to sync my shapefile data with a PostGIS database. This sync looks for created, changed or deleted geometries and attributes in the shapefile and pushes the changes into the geodatabase to keep it to the current state (this workflow doesn't allow to edit directly on the geodatabase for some reasons).

I am unsure if this works after saving my edits or if I have to close QGIS. Regarding your explanation it has to be closed and then I can run my transformation.

#5 Updated by Axel Schaefer over 10 years ago

OK. Roll back. I have an error in the shapefile. It's corrupt. It only contains 6 simple shapes that I've edited with QGIS, but it seems to be corrupted. Therefore all workflows after editing went wrong. I have to test that again but it seems that this issue here can be closed.

Sorry for any inconvenience.

#6 Updated by Giovanni Manghi over 10 years ago

  • Resolution set to invalid
  • Status changed from Feedback to Closed

Also available in: Atom PDF