MappingTrimesh#
For deeper information about the concept see: Mesh Mapper
Class Methods
|
Create a |
Main API Methods
Map coordinates by intersecting rays with the mesh surface. |
|
Sample heights by casting vertical rays against the mesh. |
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.MappingTrimesh(mesh_path: Path | str, crs: CRS | None = None, coordinate_shift: Vector3D | None = None)[source]#
Bases:
MappingBaseMapping backend that intersects rays with a mesh surface.
- Parameters:
mesh_path (Path | str)
crs (CRS | None)
coordinate_shift (Vector3D | None)
- __init__(mesh_path: Path | str, crs: CRS | None = None, coordinate_shift: Vector3D | None = None)[source]#
Create a mesh-based mapper.
- Parameters:
mesh_path (Path | str) – Path to the mesh file.
crs (CRS | None) – CRS of the mesh, defaults to
None.coordinate_shift (Vector3D | None) – Optional translation applied to the mesh coordinates, defaults to
None.
- Raises:
FileNotFoundError – If
mesh_pathdoes not exist.CRSnoZaxisError – If a specified CRS does not define a Z axis.
MappingError – If the mesh is empty or the file format is unsupported.
- property type#
Return the mapper type.
- classmethod from_dict(mapper_dict: Mapping[str, Any]) MappingTrimesh[source]#
Create a
MappingTrimeshinstance from a configuration dictionary.Required keys: -
type: must beTrimesh-mesh_filepath: file path to the meshOptional keys: -
crs: CRS WKT string, defaults toNone-coordinate_shift: translation vector, defaults toNone- 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 the mapper type is unsupported.
CRSInputError – If the CRS WKT string is invalid.
- property param_dict#
Return the mapper configuration dictionary.
- Returns:
Mapper configuration dictionary.
- Return type:
dict[str, Any]
- 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 coordinates by intersecting rays with the mesh surface.
- 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 intersection 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.
- map_heights_from_coordinates(coordinates_crs_s: ArrayNx3 | ArrayNx2, crs_s: CRS | None = None, transformer: CoordinateTransformer | None = None) MappingResultSuccess | ResultFailure[Issue][source]#
Sample heights by casting vertical rays against the mesh. Vertical in the sense of vertical in the mapper crs
- Parameters:
coordinates_crs_s (ArrayNx3 | ArrayNx2) – Coordinates to sample (N×2 or N×3).
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 sampled coordinates and a validity mask.
- Return type:
MappingResult
- Raises:
CRSInputError – If both
crs_sandtransformerare provided.CoordinateTransformationError – If coordinate transformation fails.