I found that two exactly identical Geopackages do not share the same checksum as one would probably expect (and is vital when syncing files using rsync for example). Here is a reproducible example:
Get some sample data:
$> wget https://biogeo.ucdavis.edu/data/gadm3.6/gpkg/gadm36_ZWE_gpkg.zip
$> unzip gadm36_ZWE_gpkg.zip
Now use ogr2ogr
to copy the data to two different files with exactly the same parameters:
$> ogr2ogr -f GPKG test1.gpkg -nln testlayername gadm36_ZWE.gpkg
$> ogr2ogr -f GPKG test2.gpkg -nln testlayername gadm36_ZWE.gpkg
If we check the checksums they happen to differ:
$> md5sum test*.gpkg
ad2fe21516a94ab9f2c0bca37c171028 test1.gpkg
240b65bac70687d8fc65c70c9c4dbb46 test2.gpkg
So after some experiments, I found that it must have to do something with the "Geo" component, as
ogr2ogr -f sqlite test[1|2].sqlite -nln testlayername gadm36_ZWE.gpkg
would generate the same chechsum for both outputs while
ogr2ogr -f sqlite test[1|2].sqlite -nln testlayername gadm36_ZWE.gpkg -dsco "SPATIALITE=YES"
would not generate the same chechsum for both outputs.
Am I completely off here? Does anybody know what causes the difference in checksums and is there any way to prevent that when using GPKGs?
vbindiff
is a nice tool to look at differences between files on a binary level (includes a string-y view of readable text as well).