RasterioCRSTransformer#

class RasterioCRSTransformer[source]#

Bases: CRSTransformer

Transformer for a RasterioRasterSource.

__init__(transform: Affine, image_crs: Any, map_crs: Any = 'epsg:4326', round_pixels: bool = True)[source]#

Constructor.

Parameters
  • transform (Affine) – Rasterio affine transform.

  • image_crs (Any) – CRS of image in format that PyProj can handle eg. wkt or init string.

  • map_crs (Any) – CRS of the labels. Defaults to “epsg:4326”.

  • round_pixels (bool) – If True, round outputs of map_to_pixel and inputs of pixel_to_map to integers. Defaults to False.

Methods

__init__(transform, image_crs[, map_crs, ...])

Constructor.

from_dataset(dataset[, map_crs])

from_uri(uri[, map_crs])

map_to_pixel(inp)

Transform input from pixel to map coords.

pixel_to_map(inp)

Transform input from pixel to map coords.

__init__(transform: Affine, image_crs: Any, map_crs: Any = 'epsg:4326', round_pixels: bool = True)[source]#

Constructor.

Parameters
  • transform (Affine) – Rasterio affine transform.

  • image_crs (Any) – CRS of image in format that PyProj can handle eg. wkt or init string.

  • map_crs (Any) – CRS of the labels. Defaults to “epsg:4326”.

  • round_pixels (bool) – If True, round outputs of map_to_pixel and inputs of pixel_to_map to integers. Defaults to False.

classmethod from_dataset(dataset, map_crs: Optional[str] = 'epsg:4326', **kwargs) RasterioCRSTransformer[source]#
Parameters

map_crs (Optional[str]) –

Return type

RasterioCRSTransformer

classmethod from_uri(uri: str, map_crs: Optional[str] = 'epsg:4326', **kwargs) RasterioCRSTransformer[source]#
Parameters
Return type

RasterioCRSTransformer

map_to_pixel(inp)#

Transform input from pixel to map coords.

Parameters

inp – (x, y) tuple or Box or rasterio Window or shapely geometry in pixel coordinates. If tuple, x and y can be single values or array-like.

Returns

Coordinate-transformed input in the same format.

pixel_to_map(inp)#

Transform input from pixel to map coords.

Parameters

inp – (x, y) tuple or Box or rasterio Window or shapely geometry in pixel coordinates. If tuple, x and y can be single values or array-like.

Returns

Coordinate-transformed input in the same format.