MappingBase#
Main API Methods
|
Map 3D coordinates from ray definitions. |
Sample heights for given 2D/3D coordinates. |
Properties
Return the mapper type. |
|
Return the mapper configuration dictionary. |
|
Return the CRS of the mapper (if set). |
|
Return the CRS as WKT string, or |
- class weitsicht.MappingBase[source]#
Bases:
objectAbstract base class for all mapping backends.
- abstractmethod classmethod from_dict(mapper_dict: Mapping[str, Any]) _Self[source]#
Create a mapper instance from a configuration dictionary.
- Parameters:
mapper_dict (Mapping[str, Any]) – Mapper configuration dictionary (typically created via
mapper.param_dict).- Returns:
Instantiated mapper.
- Return type:
- Raises:
KeyError – If a required dictionary key is missing.
ValueError – If configuration values are invalid.
CRSInputError – If CRS input in the configuration is invalid (e.g. malformed WKT).
CRSnoZaxisError – If a required CRS does not define a Z axis.
MappingError – If the mapper cannot be initialized.
- abstract property type: MappingType#
Return the mapper type.
- Returns:
Mapper type.
- Return type:
MappingType
- abstract property param_dict: Mapping[str, Any]#
Return the mapper configuration dictionary.
This dictionary is intended to be used with
from_dict().- Returns:
Mapper configuration dictionary.
- Return type:
Mapping[str, Any]
- property crs: CRS | None#
Return the CRS of the mapper (if set).
- Returns:
CRS of the mapper.
- Return type:
CRS | None
- property crs_wkt: str | None#
Return the CRS as WKT string, or
Noneif not set.- Returns:
CRS WKT string.
- Return type:
str | None
- abstractmethod map_coordinates_from_rays(ray_vectors_crs_s: ArrayNx3, ray_start_crs_s: ArrayNx3, crs_s: CRS | None = None, transformer: CoordinateTransformer | None = None) MappingResultSuccess | ResultFailure[Issue][source]#
Map 3D coordinates from ray definitions.
The input rays are provided by a ray start point and a ray direction vector. If a CRS conversion is required, pass either
crs_s(and the mapper’scrsmust be set) or a preconfiguredtransformer.- Parameters:
ray_vectors_crs_s (ArrayNx3) – Ray direction vectors (N×3).
ray_start_crs_s (ArrayNx3) – Ray start points (N×3), same shape as
ray_vectors_crs_s.crs_s (CRS | None) – CRS of the input rays, defaults to None.
transformer (CoordinateTransformer | None) – Coordinate transformer to mapper CRS, defaults to None.
- Returns:
Mapping result containing mapped coordinates and a validity mask.
- Return type:
MappingResult
- Raises:
ValueError – If input arrays have incompatible shapes.
CRSInputError – If both
crs_sandtransformerare provided.CoordinateTransformationError – If coordinate transformation fails.
- abstractmethod map_heights_from_coordinates(coordinates_crs_s: ArrayNx3 | ArrayNx2, crs_s: CRS | None = None, transformer: CoordinateTransformer | None = None) MappingResultSuccess | ResultFailure[Issue][source]#
Sample heights for given 2D/3D coordinates.
This is typically used to lift planar coordinates (x, y) to 3D (x, y, z) using a DEM.
- Parameters:
coordinates_crs_s (ArrayNx3 | ArrayNx2) – Coordinates to sample (N×2 or N×3). If N×2, Z is backend-defined.
crs_s (CRS | None) – CRS of the input coordinates, defaults to None.
transformer (CoordinateTransformer | None) – Coordinate transformer to mapper CRS, defaults to None.
- Returns:
Mapping result containing coordinates with sampled heights and a validity mask.
- Return type:
MappingResult
- Raises:
ValueError – If input arrays have incompatible shapes.
CRSInputError – If both
crs_sandtransformerare provided.CoordinateTransformationError – If coordinate transformation fails.