MappingBase#

Main API Methods

MappingBase.map_coordinates_from_rays(...[, ...])

Map 3D coordinates from ray definitions.

MappingBase.map_heights_from_coordinates(...)

Sample heights for given 2D/3D coordinates.

Properties

MappingBase.type

Return the mapper type.

MappingBase.param_dict

Return the mapper configuration dictionary.

MappingBase.crs

Return the CRS of the mapper (if set).

MappingBase.crs_wkt

Return the CRS as WKT string, or None if not set.

class weitsicht.MappingBase[source]#

Bases: object

Abstract base class for all mapping backends.

__init__()[source]#

Initialize a mapper with an optional CRS (set via crs).

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:

MappingBase

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 None if 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’s crs must be set) or a preconfigured transformer.

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:
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: