crs¶
occulus.crs
¶
Coordinate reference system utilities for Occulus.
Re-exports the public transform API so callers can write::
from occulus.crs import reproject, transform_coordinates
reproject(cloud, target_crs, source_crs=None)
¶
Reproject a point cloud to a new coordinate reference system.
If source_crs is not provided it is inferred from
cloud.metadata.coordinate_system. When that field is also empty
an :class:~occulus.exceptions.OcculusCRSError is raised.
The returned cloud is a new object — the input is never mutated.
All per-point attributes (intensity, classification, rgb, normals,
return_number, number_of_returns) are carried over unchanged. The
metadata.coordinate_system field on the result is set to
target_crs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cloud
|
PointCloud
|
Input point cloud. |
required |
target_crs
|
str
|
Target CRS identifier (e.g. |
required |
source_crs
|
str | None
|
Source CRS identifier. If |
None
|
Returns:
| Type | Description |
|---|---|
PointCloud
|
New cloud with reprojected XYZ and updated metadata. |
Raises:
| Type | Description |
|---|---|
OcculusCRSError
|
If the source CRS cannot be determined, or if the transform fails. |
Source code in src/occulus/crs/transform.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 | |
transform_coordinates(xyz, source_crs, target_crs)
¶
Transform an (N, 3) coordinate array from one CRS to another.
Uses pyproj.Transformer.from_crs with always_xy=True so that
the first column is always easting/longitude and the second is
northing/latitude, regardless of the CRS axis order definition.
The Z (elevation) column is passed through unchanged.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
xyz
|
NDArray[float64]
|
Input coordinates as an (N, 3) float64 array. |
required |
source_crs
|
str
|
Source CRS identifier accepted by |
required |
target_crs
|
str
|
Target CRS identifier accepted by |
required |
Returns:
| Type | Description |
|---|---|
NDArray[float64]
|
Transformed coordinates as an (N, 3) float64 array. |
Raises:
| Type | Description |
|---|---|
OcculusCRSError
|
If |