Skip to content

Improve mbtiles diff validation, add new metadata field, usability #1244

Open
@nyurik

Description

@nyurik

Current state

  • Files generated by martin's mbtiles tool contain agg_tiles_hash metadata field. The field represent an aggregate hash of all tiles table (z/x/y/data). See docs.
  • When diffing two mbtiles files - file A and file B, the generated delta file will include agg_tiles_hash_after_apply value - the hash of the file B.

Proposal

Current design has a few shortcomings that need to be addressed. The biggest issues is that any mbtiles can be applied to any other mbtiles - which is different than "merge-copying" (simply adding content to the same file from multiple other files, where tiles with the same x/y/z override existing ones.

  • Add a new metadata field agg_tiles_hash_before_apply (name?) to the delta files -- this corresponds to the agg_tiles_hash of thefile A.
  • Improve logic and default behavior

Creating a diff file between A and B

  • Refuse to work if either A or B files contain agg_tiles_hash_before_apply or agg_tiles_hash_after_apply (unless there is a --force flag)
  • If either files A or B do not contain agg_tiles_hash, compute it (but don't save it?)
  • Store agg_tiles_hash as agg_tiles_hash_before_apply and agg_tiles_hash_after_apply values in the delta file

Patch file A with a diff, or apply on copy

  • Refuse to work if file A contain agg_tiles_hash_before_apply or agg_tiles_hash_after_apply
  • Refuse to work if the diff file does NOT contain agg_tiles_hash, agg_tiles_hash_before_apply or agg_tiles_hash_after_apply
  • Unless some --validate flag is set, accept agg_tiles_hash stored in file A as valid. If it does not exist, compute it.
  • Refuse to work if the stored/computed agg_tiles_hash does not match agg_tiles_hash_before_apply
  • After patching file A, validate the file against the agg_tiles_hash_after_apply value

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliRelated to Command Line InterfacembtilesAnything related to Martin's MBTiles support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions