TileStitcher

From OpenStreetMap Wiki
Jump to navigation Jump to search

TileSticher (or in pip MapTileStitcher) is a basic python script for creating (potentially large) high-resolution map images by defining a bounding-box of request. The code runs offline, while the map download process requires internet access.

Included Parts

Tile Download

The user an choose from multiple tile-servers (such as OSM original) to download the tiles from. If there are multiple sub-servers available (i.e. the a,b, and c in http://{a|b|c}.tileserver/{zoom}/{x}/{y}.png) the downloader parallelizes the requests to both allow fast downloading and reduce the server's load.


To make the downloader work, it requires

  • a zoom level (typically from 1,..,18)
  • a request bounding box: [lat, lon] x [lat, lon]

Further, the server can be configured, if required.


Advanced

If a link is given like this,

http://{a|b|c}.tileserver/{zoom}/{x}/{y}.png

it can be inserted as

tile_style = [
    'http://a.tileserver/{zoom}/{x}/{y}.png',
    'http://b.tileserver/{zoom}/{x}/{y}.png',
    'http://c.tileserver/{zoom}/{x}/{y}.png',
    ]
downloader = TileDownloader(tile_servers=tile_style)

to allow for parallelized download.


Tile Stitching

Once the files are downloaded, the program stitches together all files to one output file. The file format can be chosen from typical image formats.