- Notifications
You must be signed in to change notification settings - Fork0
🗺 A set of CLI tools for working with .mbtiles map files, including a map downloader.
License
ZUB3C/sqlitedb-map-tools
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A set of CLI tools for working with .mbtiles map files, including a map downloader.
mbtiles2sqlitedb
: Converts .mbtiles format to .sqlitedb format, compatible withOsmAnd andLocus.sqlitedb-cut
: Extracts a rectangular section of a map from a .sqlitedb file into a separate map file.sqlitedb-merge
: Merges multiple .sqlitedb map files into a single file.nakarteme-dl
: Downloads .mbtiles map files fromnakarte.me.
Additionally, you can compress tiles using JPEG to reduce file size (see examples).
Python 3.10 or above is required.
Usingpipx
(recommended)
pipx install git+https://github.com/ZUB3C/sqlitedb-map-tools.git
pip install git+https://github.com/ZUB3C/sqlitedb-map-tools.git
mbtiles2sqlitedb [OPTIONS] INPUT_FILE OUTPUT_FILE
Converts .mbtiles format to .sqlitedb format suitable for OsmAnd and Locus.
-f, --force Override the output file if it exists.-j, --jpeg-quality INTEGER Convert tiles to JPEG with the specified quality.
Simple:
mbtiles2sqlitedb input.mbtiles output.sqlitedb
Convert tiles to JPEG with compression level set to 80:
mbtiles2sqlitedb -j 80 input.mbtiles output.sqlitedb
sqlitedb-cut [OPTIONS] INPUT_FILE OUTPUT_FILE
Extracts a rectangular section of a map from a .sqlitedb file into a separate map.
-l, --upper-left FLOAT... Coordinates of the upper-left corner of the section to be extracted. [required]-r, --bottom-right FLOAT... Coordinates of the bottom-right corner of the section to be extracted. [required]-f, --force Override the output file if it exists.
This command extracts a rectangular section frommap.sqlitedb
and saves it asmap-fragment.sqlitedb
, using the specified coordinates for the upper-left andbottom-right corners:
sqlitedb-cut map.sqlitedb map-fragment.sqlitedb --upper-left 44.00961 42.23831 --bottom-right 43.15811 43.01285
sqlitedb-merge [OPTIONS] INPUT_FILES OUTPUT_FILE
Merges multiple .sqlitedb map files into a single file.
If multiple files contain tiles with the same coordinates, the tile from thefirst file in the argument list will be used.
-f, --force Override the output file if it exists.
sqlitedb-merge map1.sqlitedb map2.sqlitedb merged-map.sqlitedb
nakarteme-dl [OPTIONS] MAPS...
Downloads .mbtiles map files fromtiles.nakarte.me.
Useall
as the map name to download all available maps.
-o, --output DIRECTORY Directory where maps will be downloaded.-f, --force Override the output file if it exists.
nakarteme-dl -o mbtiles topo500 topo1000
raster-map-dl [OPTIONS] OUTPUT_FILE
Download tiles from remote server to .sqlitedb file.
-f, --force Override the output file if it exists.-u, --url-mask TEXT Server url mask from where you want to download tiles. It should have `{x}`, `{y}` and `{z}` in it. For example, https://tile.o penstreetmap.org/{z}/{x}/{y}.png. [required]-l, --upper-left FLOAT... Coordinates of the upper-left corner of the section to be extracted. [required]-r, --bottom-right FLOAT... Coordinates of the bottom-right corner of the section to be extracted. [required]--min-zoom INTEGER Minimum zoom with which tiles will be downloaded. By default 0.--max-zoom INTEGER Minimum zoom with which tiles will be downloaded. By default 18.--max-rpc, --max-requests-per-second INTEGER Max requests per second limit. By default no limit.-t, --timeout INTEGER Request timeount in seconds. By default 300.--max-retry-count INTEGER Maximum number of retries to server if timeout is reached. By default 10.-c, --chuck-size INTEGER Size of a chunk with tiles stored in RAM. After filling a chunk with tiles, they are saved to .sqlitedb output file. By default 2048
raster-map-dl opentopomap-elbrus-region.sqlitedb -u"https://c.tile.opentopomap.org/{z}/{x}/{y}.png" --min-zoom 10 --max-zoom 16 --upper-left 44.00961 42.23831 --bottom-right 43.15811 43.01285
Install Rye by followingtheinstallation guide.
Userye sync
to install dependencies and required Python version.
Userye check --fix
andrye fmt
to lint and format code. Assumed to be run before each committo guarantee code quality.
Userye run basedpyright
to ensure typing is correct.
This project is licensed under the GPLv3+ license - see thelicense file for details.
About
🗺 A set of CLI tools for working with .mbtiles map files, including a map downloader.
Topics
Resources
License
Stars
Watchers
Forks
Releases
Languages
- Python100.0%