pyguymer3.openstreetmap.tiles

pyguymer3.openstreetmap.tiles(lonC_deg, latC_deg, zoom, width, height, sess, /, *, background=(255, 255, 255), chunksize=1048576, cookies=None, debug=True, exiftoolPath=None, fill=(255, 0, 0, 127), gifsiclePath=None, headers=None, jpegtranPath=None, optipngPath=None, radius=None, scale=1, thunderforestKey=None, thunderforestMap='atlas', timeout=10.0, verify=True)[source]

Merge some OpenStreetMap tiles around a location into one large tile

This function reads in a location, a zoom and an image size. It then fetches all of the OpenStreetMap tiles that are in that field-of-view and returns an image of them all merged together.

Parameters:
  • lonC_deg (float) – the central longitude (in degrees)

  • latC_deg (float) – the central latitude (in degrees)

  • zoom (int) – the OpenStreetMap zoom level

  • width (int) – the width of the merged tile (in pixels)

  • height (int) – the height of the merged tile (in pixels)

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

  • background (tuple of int, optional) – the background colour of the merged tile

  • 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)

  • fill (tuple of int, optional) – the fill colour of the circle around the central location, if drawn

  • 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)

  • radius (int, optional) – the radius of the circle around the central location, if None then no circle is drawn (in pixels)

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

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

  • thunderforestMap (str, 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:

tilesIm – the merged tile

Return type:

PIL.Image

Notes

Copyright 2017 Thomas Guymer [1]

References