I have been working with a Geopackage in QGIS and R for a few weeks, storing ~ 12 layers of various geometry types.
Needing to email it to a colleague, I discovered the size of the file had grown to > 230MB
l *.gpkg -rw-r--r-- 1 user staff 236M 24 Nov 12:37 AerialSurvey.gpkg
I was sure that there was nowhere near that amount of data in the system - so copied everything to a new geopackage:
ogr2ogr -f GPKG AerialSurvey-2.gpkg AerialSurvey.gpkg
The new copy is 1/30 the size!
l -h *.gpkg -rw-r--r-- 1 user staff 236M 24 Nov 12:37 AerialSurvey.gpkg -rw-r--r-- 1 user staff 6.7M 25 Nov 10:13 AerialSurvey-2.gpkg
My workflow involves analysis and re-saving of layers from time to time, from both QGIS and R.
Obviously this increase in file size is quick to fix with
ogr2ogr, but why does this happen and how can it be prevented in future?