tile module

class tile.Tile3857

Bases: tile.TileBase

EPSG:3857 implementation

bounds(x, y, z)
tile(easting, northing, z)
class tile.Tile4326

Bases: tile.TileBase

EPSG:4326 implementation of TileBase for tile operations

Notes

For tests:
  • sum of first two digits of quadtree should NEVER be less than 2 or greater than 4
bounds(x, y, z)

Return the lon/lat bbox of a tile with x,y,z coords. NOTE: x varies left to right y varies top to bottom

tile(lon, lat, z)

Compute the (x,y,z) coords for a EPSG:4326 (WGS:84) lon-lat.

Parameters
  • lat (float) – latitude in decimal degrees

  • lon (float) – longitude in decimal degrees

  • z (int) – zoom level

class tile.TileBase

Bases: abc.ABC

Abstract Base for Tile objects. Operations on Tiles utilize quadtree math, allowing quick zooming ability inside square spaces.

bounding_tile(west, south, east, north)
abstract bounds()
buffer(b)
nudge(b, EPS=0.001)
parent_tile(lonlats, MAX_ZOOM=32)

common parent of a list of lon/lat pairs

quadkey(x, y, z)

tile to quadkey

Parameters
  • x (int) – tile x coordinate.

  • y (int) – tile y coordinate.

  • z (int) – zoom level.

Returns

The quadkey.

Return type

str

quadkey_to_tile(qk)

Compute the tile for a given quadkey. :param str qk: quadkey :return tuple (x, y, i+1)

abstract tile()
tile_ij(x, y, z, p)

pixel offset within containing tile

Parameters
  • x (int) – tile x coordinate.

  • y (int) – tile y coordinate.

  • z (int) – zoom level.

  • p (int) – relative parent level. positive is zoom out.

Returns

The quadkey.

Return type

str

(i, j) offset in pixels

viewport(bbox, width, height, MAX_ZOOM=32)
zoomout(b, nz=0)