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: Any | None = None, image_crs: str | None = None, map_crs: str | None = None)[source]#
Methods
__init__
([transform, image_crs, map_crs])Transform input from map to pixel coords.
Transform input from pixel to map coords.
- __init__(transform: Any | None = None, image_crs: str | None = None, map_crs: str | None = None)[source]#
- map_to_pixel(inp: tuple[float, float], bbox: rastervision.core.box.Box | None = None) tuple[int, int] [source]#
- map_to_pixel(inp: tuple[numpy.ndarray, numpy.ndarray], bbox: rastervision.core.box.Box | None = None) tuple[numpy.ndarray, numpy.ndarray]
- map_to_pixel(inp: Box, bbox: rastervision.core.box.Box | None = None) Box
- map_to_pixel(inp: BaseGeometry, bbox: rastervision.core.box.Box | None = None) BaseGeometry
Transform input from map to pixel coords.
- Parameters:
inp – (x, y) tuple or Box or shapely geometry in map coordinates. If tuple, x and y can be single values or array-like.
bbox – If the extent of the associated RasterSource is constrained via a bbox, it can be passed here to get an output that is in coordinates of the bbox rather than the full extent of the data source of the RasterSource. Defaults to None.
- Returns:
Coordinate-transformed input in the same format.
- pixel_to_map(inp: tuple[float, float], bbox: rastervision.core.box.Box | None = None) tuple[float, float] [source]#
- pixel_to_map(inp: tuple[numpy.ndarray, numpy.ndarray], bbox: rastervision.core.box.Box | None = None) tuple[numpy.ndarray, numpy.ndarray]
- pixel_to_map(inp: Box, bbox: rastervision.core.box.Box | None = None) Box
- pixel_to_map(inp: BaseGeometry, bbox: rastervision.core.box.Box | None = None) BaseGeometry
Transform input from pixel to map coords.
- Parameters:
inp – (x, y) tuple or Box or shapely geometry in pixel coordinates. If tuple, x and y can be single values or array-like.
bbox – If the extent of the associated RasterSource is constrained via a bbox, it can be passed here so that the input is interpreted to be in coordinates of the bbox rather than the full extent of the data source of the RasterSource. Defaults to None.
- Returns:
Coordinate-transformed input in the same format.