https://github.com/gumblex/tms2geotiff
Download tiles from Tile Map Server (online maps) and make a large geo-referenced image
https://github.com/gumblex/tms2geotiff
geotiff gis online-maps tms
Last synced: 9 months ago
JSON representation
Download tiles from Tile Map Server (online maps) and make a large geo-referenced image
- Host: GitHub
- URL: https://github.com/gumblex/tms2geotiff
- Owner: gumblex
- License: bsd-2-clause
- Created: 2019-01-07T05:50:31.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2023-07-30T08:19:38.000Z (over 2 years ago)
- Last Synced: 2025-03-24T19:45:53.637Z (10 months ago)
- Topics: geotiff, gis, online-maps, tms
- Language: Python
- Homepage:
- Size: 44.9 KB
- Stars: 150
- Watchers: 4
- Forks: 28
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# tms2geotiff
Download tiles from [Tile Map Server](https://wiki.openstreetmap.org/wiki/Slippy_map_tilenames) (online maps) and make a large image.
If output is TIFF, it can write to a GeoTIFF image.
Otherwise, it will save to a normal image with a World File for georeferencing (in EPSG:3857).
* Dependencies: Pillow, requests/httpx.
* Optional dependencies:
* GDAL, numpy: for writing **BigTIFF (>4GB GeoTIFF)**
* tqdm: progress bar
It can save the tiles directly as a **MBTiles** file now. The big image file is not required to generate.
**GUI**: Directly run `python3 tms2geotiff.py` to open a GUI window.
usage: tms2geotiff.py [-h] [-s URL] [-f LAT,LON] [-t LAT,LON] [-e min_lon,min_lat,max_lon,max_lat] [-z ZOOM]
[-m MBTILES] [-g]
[output]
Merge TMS tiles to a big image.
positional arguments:
output output image file (can be omitted)
options:
-h, --help show this help message and exit
-s URL, --source URL TMS server url (default is OpenStreetMap: https://tile.openstreetmap.org/{z}/{x}/{y}.png)
-f LAT,LON, --from LAT,LON
one corner
-t LAT,LON, --to LAT,LON
the other corner
-e min_lon,min_lat,max_lon,max_lat, --extent min_lon,min_lat,max_lon,max_lat
extent in one string (use either -e, or -f and -t)
-z ZOOM, --zoom ZOOM zoom level
-m MBTILES, --mbtiles MBTILES
save MBTiles file
-g, --gui show GUI
If no parameters are specified, it will open the GUI.
For example,
python3 tms2geotiff.py -s https://tile.openstreetmap.org/{z}/{x}/{y}.png -f 45.699,127 -t 30,148.492 -z 6 output.tiff
downloads a map of Japan.
If the coordinates are negative, use `--from=-12.34,56.78 --to=-13.45,57.89`
# tmssplit
Split a large GeoTIFF image into tiles for a Tile Map Server.
Dependencies: GDAL, Pillow, numpy, scipy, pyproj
usage: tmssplit.py [-h] [-z ZOOM] [-n NAME] [-s SIZE] [-p PROJ] [-t THREADS]
inputfile outputdir
Split a big GeoTIFF image to TMS tiles.
positional arguments:
inputfile input GeoTIFF file
outputdir output directory
optional arguments:
-h, --help show this help message and exit
-z ZOOM, --zoom ZOOM zoom level(s), eg. 15 or 14-17
-n NAME, --name NAME image file name format, default {z}_{x}_{y}.png
-s SIZE, --size SIZE image size in px, default 256px
-p PROJ, --proj PROJ set projection id
-t THREADS, --threads THREADS
set thread number
-z is required