Crate mbtiles

Source
Expand description

§mbtiles

Book docs.rs docs GitHub crates.io version CI build

A library to help tile servers like Martin work with MBTiles files. When using as a lib, you may want to disable default features (i.e. the unused “cli” feature).

This crate also has a small utility that allows users to interact with the *.mbtiles files from the command line. See tools documentation for more information.

§Development

Any changes to SQL commands require running of just prepare-sqlite. This will install cargo sqlx command if it is not already installed, and update the ./sqlx-data.json file.

§License

Licensed under either of

§Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Re-exports§

pub use sqlx;

Structs§

Mbtiles
MbtilesCopier
MbtilesPool
Metadata

Enums§

AggHashType
CopyDuplicateMode
CopyType
IntegrityCheckType
MbtError
MbtType
MbtTypeCli
PatchType
PatchTypeCli
UpdateZoomType

Constants§

AGG_TILES_HASH
Metadata key for the aggregate tiles hash value
AGG_TILES_HASH_AFTER_APPLY
Metadata key for a diff file, describing the eventual AGG_TILES_HASH value of the resulting tileset once the diff is applied
AGG_TILES_HASH_BEFORE_APPLY
Metadata key for a diff file, describing the expected AGG_TILES_HASH value of the tileset to which the diff will be applied.

Functions§

action_with_rusqlite
apply_patch
calc_agg_tiles_hash
Compute the hash of the combined tiles in the mbtiles file tiles table/view. This should work on all mbtiles files perf MBTiles specification.
compute_min_max_zoom
Compute min and max zoom levels from the tiles table
create_bsdiffraw_tables
create_flat_tables
create_flat_with_hash_tables
create_metadata_table
create_normalized_tables
create_tiles_with_hash_view
detach_db
Execute DETACH DATABASE command
get_bsdiff_tbl_name
get_patch_type
Check if MBTiles has a table or a view named bsdiffraw or bsdiffrawgz with needed fields, and return the corresponding patch type. If missing, return PatchType::Whole
has_tiles_with_hash
Check if MBTiles has a table or a view named tiles_with_hash with needed fields
init_mbtiles_schema
invert_y_value
MBTiles uses a TMS (Tile Map Service) scheme for its tile coordinates (inverted along the Y axis). This function converts Y value between TMS tile coordinate to an XYZ tile coordinate.
is_empty_database
Returns true if the database is empty (no tables/indexes/…)
is_flat_tables_type
is_flat_with_hash_tables_type
is_normalized_tables_type
reset_db_settings

Type Aliases§

MbtResult