A utility for downloading map tiles from various providers based on geographic boundaries.
Project description
Tile Downloader
A Python library and GUI application for downloading map tiles from XYZ tile servers such as OpenStreetMap, Google Maps, or Esri. Supports multithreaded downloading, robust retry logic, bounding box or GeoJSON-based tile selection, optional WebP conversion, and export to PMTiles format.
Features
- Download tiles by bounding box (lat/lon) or GeoJSON geometry
- Parallel downloading using thread pools
- Configurable retry logic with exponential backoff
- Save tiles in organized XYZ folder structure (
z/x/y.png) - Optional conversion to
.webpfor smaller file sizes - Export downloaded tiles to a single PMTiles file
- Built-in Graphical User Interface (GUI) for easy use
- Logs failed downloads to
download_errors.csv
Installation
Install the package via pip:
pip install tile-downloader
To launch the GUI:
tile-downloader-gui
Usage (Programmatic)
from tile_downloader import TileDownloader
# Initialize downloader
downloader = TileDownloader(
tile_server_url_template="https://mt1.google.com/vt/lyrs=y&x={x}&y={y}&z={z}",
save_dir="./tiles",
num_workers=20,
convert_to_webp=True
)
# Option 1: Download by bounding box (lat_min, lon_min, lat_max, lon_max)
bbox = (35.0, 51.0, 36.0, 52.0)
downloader.download_tiles_from_bbox(bbox, zoom_levels=[12, 13, 14])
# Option 2: Download from GeoJSON (file path or dict)
downloader.download_tiles_from_geojson("area.geojson", zoom_levels=[12, 13, 14])
# Option 3: Export to PMTiles after download
downloader.download_tiles_from_bbox(
bbox,
zoom_levels=[12],
create_pmtiles=True,
pmtiles_filename="output.pmtiles",
delete_source_after_pmtiles=False
)
Parameters
| Parameter | Type | Description |
|---|---|---|
tile_server_url_template |
str |
URL template with {z}, {x}, {y} placeholders |
save_dir |
str |
Directory to save downloaded tiles |
num_workers |
int |
Number of concurrent threads (default: 10) |
convert_to_webp |
bool |
Convert downloaded PNGs to WebP (default: False) |
create_pmtiles |
bool |
Export tiles to a single .pmtiles file |
pmtiles_filename |
str |
Output filename when create_pmtiles=True |
delete_source_after_pmtiles |
bool |
Remove XYZ tiles after PMTiles export |
Output Structure
Tiles are saved in:
save_dir/
{z}/
{x}/
{y}.png (or .webp)
Example: tiles/12/2345/1546.png
When PMTiles export is enabled, a single output.pmtiles file is generated containing all downloaded tiles.
Error Logging
Failed downloads are saved to download_errors.csv in the save directory with columns:
zoomxyerror
Demo
See the GUI in action:
License
This project is licensed under the MIT License © 2025 A.Talebifard – see the LICENSE file for details.
Author
A.Talebifard – abbastalebifard@gmail.com
Feel free to contribute, report issues, or suggest improvements!
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tile_downloader-1.0.0.tar.gz.
File metadata
- Download URL: tile_downloader-1.0.0.tar.gz
- Upload date:
- Size: 201.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cacb6a32235b79318f8b2047211b3df48d66a0ea9b41c33d6e1aa1b39510dc65
|
|
| MD5 |
ea5e39d1ab3d5ec07eb7ffd8196c9233
|
|
| BLAKE2b-256 |
1fcfba89c3d94d44789058e71509dc7022c6011c0f3d9e24bb493f2bfc9932b5
|
File details
Details for the file tile_downloader-1.0.0-py3-none-any.whl.
File metadata
- Download URL: tile_downloader-1.0.0-py3-none-any.whl
- Upload date:
- Size: 199.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b4983a5e9971b0ec5fd325b50079d87608b7947299ca94b75592090ef066db9
|
|
| MD5 |
ec0bf59887f28208b7ce1cdbb83acf4f
|
|
| BLAKE2b-256 |
31e751848bda08c8adf81414cc6d4e30364ea3d1b7f3671474867d9b3816cead
|