pyguymer3.openstreetmap.tile

pyguymer3.openstreetmap.tile(xtile, ytile, zoom, sess, /, *, chunksize=1048576, cookies=None, debug=True, exiftoolPath=None, gifsiclePath=None, headers=None, jpegtranPath=None, optipngPath=None, scale=1, thunderforestKey=None, thunderforestMap='atlas', timeout=60.0, verify=True)[source]

Fetch an OpenStreetMap tile

This function reads in a tile number and then checks to see if the tile already exists in the local cache. It will load up the PNG image if it exists or download the OpenStreetMap tile (and save it as both a NPY array and a PNG image) if it is missing.

Parameters:
  • xtile (int) – the tile x location

  • ytile (int) – the tile y location

  • zoom (int) – the OpenStreetMap zoom level

  • sess (requests.Session) – the session for any requests calls

  • chunksize (int, optional) – the size of the chunks of any files which are read in (in bytes)

  • cookies (dict, optional) – extra cookies for any requests calls

  • debug (bool, optional) – print debug messages

  • exiftoolPath (str, optional) – the path to the “exiftool” binary (if not provided then Python will attempt to find the binary itself)

  • gifsiclePath (str, optional) – the path to the “gifsicle” binary (if not provided then Python will attempt to find the binary itself)

  • headers (dict, optional) – extra headers for any requests calls

  • jpegtranPath (str, optional) – the path to the “jpegtran” binary (if not provided then Python will attempt to find the binary itself)

  • optipngPath (str, optional) – the path to the “optipng” binary (if not provided then Python will attempt to find the binary itself)

  • scale (int, optional) – the scale of the tile

  • thunderforestKey (string, optional) – your personal API key for the Thunderforest service (if provided then it is assumed that you want to use the Thunderforest service)

  • thunderforestMap (string, optional) – the Thunderforest map style (see https://www.thunderforest.com/maps/)

  • timeout (float, optional) – the timeout for any requests/subprocess calls (in seconds)

  • verify (bool, optional) – verify the server’s certificates for any requests calls

Returns:

image – the OpenStreetMap tile

Return type:

PIL.Image

Notes

Copyright 2017 Thomas Guymer [1]

References