Skip to content

Python script for converting XYZ raster tiles for slippy maps to a georeferenced TIFF image

License

Notifications You must be signed in to change notification settings

mchambon/tiles-to-tiff

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

ℹ️ If you came here from the original tutorial you will find the corresponding source code in the v1 branch: https://github.com/jimutt/tiles-to-tiff/tree/v1

The master branch has been updated with a small addition to offer a simple CLI.

tiles-to-tiff

Python script for converting XYZ raster tiles for slippy maps to a georeferenced TIFF image.

Prerequisites:

  • Python & available GDAL installation

Usage:

tiles_to_tiff {tile_source} {lng_min} {lat_min} {lng_max} {lat_max} -o {output_directory} -z {zoom level}

Create georeferenced TIFF from online tileserver:

python tiles_to_tiff https://tileserver-url.com/{z}/{x}/{y}.png 21.49147 65.31016 21.5 65.31688 -o output -z 17

Use local tile source:

python tiles_to_tiff file:///Users/Bob/local-directory 21.49147 65.31016 21.5 65.31688 -o output -z 17

TMS Tiles

In the tile source there is the ability to use {-y} in the URL. In TMS, the origin of coordinates is the bottom left corner so the Y coordinate goes up.

CLI arguments:

  • lng_min - Min longitude of bounding box
  • lat_min - Min latitude of bounding box
  • lng_max - Max longitude of bounding box
  • lat_max - Max latitude of bounding box
  • -z, --zoom - Tilesource zoom level, default 14
  • -o, --output - Output directory, required

About

Python script for converting XYZ raster tiles for slippy maps to a georeferenced TIFF image

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%