You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/src/mbtiles-diff.md
+22-5Lines changed: 22 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,16 @@
2
2
3
3
## `mbtiles diff`
4
4
5
-
Copy command can also be used to compare two mbtiles files and generate a delta (diff) file. The diff file can be [applied](#mbtiles-apply-patch) to the `src_file.mbtiles` elsewhere, to avoid copying/transmitting the entire modified dataset. The delta file will contain all tiles that are different between the two files (modifications, insertions, and deletions as `NULL` values), for both the tile and metadata tables.
5
+
Copy command can also be used to compare two mbtiles files and generate a delta (diff) file. The diff file can
6
+
be [applied](#mbtiles-apply-patch) to the `src_file.mbtiles` elsewhere, to avoid copying/transmitting the entire
7
+
modified dataset. The delta file will contain all tiles that are different between the two files (modifications,
8
+
insertions, and deletions as `NULL` values), for both the tile and metadata tables.
6
9
7
-
There is one exception: `agg_tiles_hash` metadata value will be renamed to `agg_tiles_hash_in_diff`, and a new `agg_tiles_hash` will be generated for the diff file itself. This is done to avoid confusion when applying the diff file to the original file, as the `agg_tiles_hash` value will be different after the diff is applied. The `apply-diff` command will automatically rename the `agg_tiles_hash_in_diff` value back to `agg_tiles_hash` when applying the diff.
10
+
There is one exception: `agg_tiles_hash` metadata value will be renamed to `agg_tiles_hash_after_apply`, and a
11
+
new `agg_tiles_hash` will be generated for the diff file itself. This is done to avoid confusion when applying the diff
12
+
file to the original file, as the `agg_tiles_hash` value will be different after the diff is applied. The `apply-diff`
13
+
command will automatically rename the `agg_tiles_hash_after_apply` value back to `agg_tiles_hash` when applying the
14
+
diff.
8
15
9
16
```shell
10
17
# This command will compare `file1.mbtiles` and `file2.mbtiles`, and generate a new diff file `diff.mbtiles`.
Apply the diff file generated with the `mbtiles diff` command above to an MBTiles file. The diff file can be applied to the `src_file.mbtiles` that has been previously downloaded to avoid copying/transmitting the entire modified dataset again. The `src_file.mbtiles` will modified in-place. It is also possible to apply the diff file while copying the source file to a new destination file, by using the [`mbtiles copy --apply-patch`](mbtiles-copy.md#mbtiles-copy---apply-patch) command.
34
+
Apply the diff file generated with the `mbtiles diff` command above to an MBTiles file. The diff file can be applied to
35
+
the `src_file.mbtiles` that has been previously downloaded to avoid copying/transmitting the entire modified dataset
36
+
again. The `src_file.mbtiles` will modified in-place. It is also possible to apply the diff file while copying the
37
+
source file to a new destination file, by using
38
+
the [`mbtiles copy --apply-patch`](mbtiles-copy.md#mbtiles-copy---apply-patch) command.
28
39
29
-
Note that the `agg_tiles_hash_in_diff` metadata value will be renamed to `agg_tiles_hash` when applying the diff. This is done to avoid confusion when applying the diff file to the original file, as the `agg_tiles_hash` value will be different after the diff is applied.
40
+
Note that the `agg_tiles_hash_after_apply` metadata value will be renamed to `agg_tiles_hash` when applying the diff.
41
+
This is done to avoid confusion when applying the diff file to the original file, as the `agg_tiles_hash` value will be
Another way to apply the diff is to use the `sqlite3` command line tool directly. This SQL will delete all tiles from `src_file.mbtiles` that are set to `NULL` in `diff_file.mbtiles`, and then insert or update all new tiles from `diff_file.mbtiles` into `src_file.mbtiles`, where both files are of `flat` type. The name of the diff file is passed as a query parameter to the sqlite3 command line tool, and then used in the SQL statements. Note that this does not update the `agg_tiles_hash` metadata value, so it will be incorrect after the diff is applied.
50
+
Another way to apply the diff is to use the `sqlite3` command line tool directly. This SQL will delete all tiles
51
+
from `src_file.mbtiles` that are set to `NULL` in `diff_file.mbtiles`, and then insert or update all new tiles
52
+
from `diff_file.mbtiles` into `src_file.mbtiles`, where both files are of `flat` type. The name of the diff file is
53
+
passed as a query parameter to the sqlite3 command line tool, and then used in the SQL statements. Note that this does
54
+
not update the `agg_tiles_hash` metadata value, so it will be incorrect after the diff is applied.
0 commit comments