Add "extract" subcommand to mbtiles tool #1725
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR adds a "extract" subcommand to the
mbtiles
tool, to write the tiles contained in a mbtiles archive to the filesystem or to a object store.While I am not sure if this feature is still in scope for the
mbtiles
tool, we where in need of a feature like this to switch our rendering process tomartin
while still being able to deploy the rendered tiles directly to a object store. Maybe the naming of this subcommand is not perfect as it does a bit more than just extracting, but due to lack of a better naming idea I went with this name for now ;)The implementation is based on the
object_store
crate of the Apache Arrow project and brings support for Amazon S3 (and compatible alternatives), Azure BlobStore and Google Cloud Store. Local file access is also done through the abstraction of this crate.As configuration options for the various object store types differs, the CLI interface of the new subcommand allows passing options to the
object_store
crate using key-value pairs. I tried to document this in the commands help texts and to provide links to upstream documentation.When the object-store type supports Content-Type and Content-Encoding metadata, these are set accordingly to the contents of the mbtiles archive.
The key / filename of the single tiles is specified using a string template to provide a maximum of flexibility for the user.