tilezilla.tilespec module

Predefined tile specifications and utilities for working with tile systems

class tilezilla.tilespec.Tile(bounds, crs, index, tilespec)[source]

Bases: object

A tile

Parameters:
  • bounds (BoundingBox) – the bounding box of the tile
  • crs (str) – the coordinate reference system of the tile
  • index (tuple) – the index of this tile in the larger tile specification
  • tilespec (TileSpec) – the tile specification
str_format(s)[source]

Return a string .format’d with tile attributes

Parameters:s (s) – A string with format-compatible substitution fields
Returns:A formatted string
Return type:str
geojson

str: This tile’s geometry and crs represented as GeoJSON

horizontal

int: The horizontal index of this tile in its tile specification

polygon

shapely.geometry.Polygon: This tile’s geometry

transform

affine.Affine: The Affine transform for the tile

vertical

int: The horizontal index of this tile in its tile specification

class tilezilla.tilespec.TileSpec(ul, crs, res, size, desc=None)[source]

Bases: object

A tile specification or tile scheme

Parameters:
  • ul (tuple) – upper left X/Y coordinates
  • crs (dict) – rasterio compatible coordinate system reference dict
  • res (tuple) – pixel X/Y resolution
  • size (tuple) – number of pixels in X/Y dimension of each tile
  • desc (str) – description of tile specification (default: None)
__getitem__(index)[source]

Return a Tile for the grid row/column specified by index

bounds_to_tiles(bounds)[source]

Yield Tile objects for this TileSpec that intersect a given bounds

Note

It is required that the input bounds be in the same coordinate reference system as crs.

Parameters:bounds (BoundingBox) – input bounds
Yields:Tile – the Tiles that intersect within a bounds
point_to_tile(point)[source]

Return a Tile containing a given point (x, y)

Parameters:point (tuple) – X/Y coordinates in tile specification’s CRS
Returns:The intersecting :class`Tile`
Return type:Tile
roi_to_tiles(roi)[source]

Yield tiles overlapping a Region of Interest shapely geometry

Parameters:roi (shapely.geometry.Polygon) – A geometry in the tile specifications’ crs
Yields:Tile – A :class`Tile` that intersects the ROI
tilezilla.tilespec.retrieve_tilespecs()[source]

Retrieve default tile specifications packaged within tilezilla

Returns:default tilespecs packaged within tilezilla as TileSpec objects
Return type:dict
tilezilla.tilespec.TILESPECS = {'WELD_CONUS': <TileSpec(desc=WELD_CONUS, ul=[-2565600.0, 3314800.0], crs=<Mock name='mock.CRS.from_string()' id='140629125168376'>, res=[30, 30], size=[5000, 5000]) at 0x7fe6c51e9cf8>}

dict: Built-in tile specifications available by default