CRSTransformer#

class CRSTransformer[source]#

Bases: ABC

Transforms map points in some CRS into pixel coordinates.

Each transformer is associated with a particular RasterSource.

__init__(transform: Optional[Any] = None, image_crs: Optional[str] = None, map_crs: Optional[str] = None)[source]#
Parameters

Methods

__init__([transform, image_crs, map_crs])

map_to_pixel()

Transform input from pixel to map coords.

pixel_to_map()

Transform input from pixel to map coords.

__init__(transform: Optional[Any] = None, image_crs: Optional[str] = None, map_crs: Optional[str] = None)[source]#
Parameters
map_to_pixel(inp: Tuple[float, float]) Tuple[int, int][source]#
map_to_pixel(inp: Tuple['np.array', 'np.array']) Tuple['np.array', 'np.array']
map_to_pixel(inp: Box) Box
map_to_pixel(inp: BaseGeometry) BaseGeometry

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: Tuple[float, float]) Tuple[float, float][source]#
pixel_to_map(inp: Tuple['np.array', 'np.array']) Tuple['np.array', 'np.array']
pixel_to_map(inp: Box) Box
pixel_to_map(inp: BaseGeometry) BaseGeometry

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.