Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

🗺 A set of CLI tools for working with .mbtiles map files, including a map downloader.

License

NotificationsYou must be signed in to change notification settings

ZUB3C/sqlitedb-map-tools

 
 

Repository files navigation

LicensePython VersionsStatusMyPyRuff

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).

📦 Installing

Python 3.10 or above is required.

Usingpipx (recommended)

pipx install git+https://github.com/ZUB3C/sqlitedb-map-tools.git

Usingpip

pip install git+https://github.com/ZUB3C/sqlitedb-map-tools.git

🌿 Convert .mbtiles to .sqlitedb

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.

Examples

Simple:

mbtiles2sqlitedb input.mbtiles output.sqlitedb

Convert tiles to JPEG with compression level set to 80:

mbtiles2sqlitedb -j 80 input.mbtiles output.sqlitedb

✂️ Cut .sqlitedb map

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.

Example

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

🧩 Merge .sqlitedb maps

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.

Example

sqlitedb-merge map1.sqlitedb map2.sqlitedb merged-map.sqlitedb

⬇️ Downloadnakarte.me maps

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.

Example

nakarteme-dl -o mbtiles topo500 topo1000

⬇️ Download raster map

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

Example

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

🔧 Development

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.

📜 License

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

No releases published

Languages

  • Python100.0%

[8]ページ先頭

©2009-2025 Movatter.jp