geovista.transform
#
Coordinate reference system (CRS) transformation functions.
Notes#
Added in version 0.3.0.
Module Contents#
Functions#
|
Transform the mesh from its source CRS to the target CRS. |
|
Transform the spatial point from the source to the target CRS. |
|
Transform the spatial points from the source to the target CRS. |
- geovista.transform.transform_mesh(mesh, tgt_crs, slice_connectivity=True, rtol=None, atol=None, zlevel=None, zscale=None, inplace=False)[source]#
Transform the mesh from its source CRS to the target CRS.
- Parameters:
- mesh
PolyData
The mesh to be transformed from its source coordinate reference system (CRS) to the given tgt_crs.
- tgt_crs
CRSLike
The target coordinate reference system (CRS) of the transformation. May be anything accepted by
pyproj.crs.CRS.from_user_input()
.- slice_connectivity
bool
, default=True Slice the mesh prior to transformation in order to break mesh connectivity and create a seam in the mesh. Also see
geovista.core.slice_mesh()
.- rtol
float
, optional The relative tolerance for longitudes close to the āwrap meridianā - see
geovista.common.wrap()
for more.- atol
float
, optional The absolute tolerance for longitudes close to the āwrap meridianā - see
geovista.common.wrap()
for more.- zlevel
int
orArrayLike
, default=0 The z-axis level. Used in combination with the zscale to offset the radius/vertical by a proportional amount e.g.,
radius * zlevel * zscale
. If zlevel is not a scalar, then its shape must match or broadcast with the shape of themesh.points
.- zscale
float
, optional The proportional multiplier for z-axis zlevel. Defaults to
geovista.common.ZLEVEL_SCALE
.- inplace
bool
, default=False Update the mesh in-place. Can only perform an in-place operation when
slice_connectivity=False
.
- mesh
- Returns:
PolyData
The mesh transformed to the target coordinate reference system (CRS).
Notes
Added in version 0.3.0.
- geovista.transform.transform_point(src_crs, tgt_crs, x, y, z=None, trap=True)[source]#
Transform the spatial point from the source to the target CRS.
- Parameters:
- src_crs
CRSLike
The source Coordinate Reference System (CRS) of the provided x, y and z spatial point. May be anything accepted by
pyproj.crs.CRS.from_user_input()
.- tgt_crs
CRSLike
The target Coordinate Reference System (CRS) of the transform for the spatial point. May be anything accepted by
pyproj.crs.CRS.from_user_input()
.- x
ArrayLike
The spatial point x-value, in canonical src_crs units, to be transformed from the src_crs to the tgt_crs. Must be a scalar or a single valued 1-D array.
- y
ArrayLike
The spatial point y-value, in canonical src_crs units, to be transformed from the src_crs to the tgt_crs. Must be scalar (0-dimensional).
- z
ArrayLike
, optional The spatial point z-value, in canonical src_crs units, to be transformed from the src_crs to the tgt_crs. Must be scalar (0-dimensional).
- trap
bool
, default=True Raise an exception if an error occurs during CRS transformation of the spatial point. Otherwise,
inf
will be returned for the erroneous point.
- src_crs
- Returns:
ArrayLike
The transformed spatial point in the canonical units of the target CRS. The shape of the result will be
(3,)
.
Notes
Added in version 0.4.0.
- geovista.transform.transform_points(src_crs, tgt_crs, xs, ys, zs=None, trap=True)[source]#
Transform the spatial points from the source to the target CRS.
- Parameters:
- src_crs
CRSLike
The source Coordinate Reference System (CRS) of the provided xs, ys and zs spatial points. May be anything accepted by
pyproj.crs.CRS.from_user_input()
.- tgt_crs
CRSLike
The target Coordinate Reference System (CRS) of the transform for the spatial points. May be anything accepted by
pyproj.crs.CRS.from_user_input()
.- xs
ArrayLike
The spatial points x-values, in canonical src_crs units, to be transformed from the src_crs to the tgt_crs. May be scalar, 1-D or 2-D.
- ys
ArrayLike
The spatial points y-values, in canonical src_crs units, to be transformed from the src_crs to the tgt_crs. May be scalar, 1-D or 2-D.
- zs
ArrayLike
, optional The spatial points z-values, in canonical src_crs units, to be transformed from the src_crs to the tgt_crs. May be scalar, 1-D or 2-D.
- trap
bool
, default=True Raise an exception if an error occurs during CRS transformation of the spatial points. Otherwise,
inf
will be returned for erroneous points.
- src_crs
- Returns:
ArrayLike
The transformed spatial points in the canonical units of the target CRS. The shape of the result will either be
(1, 3)
,(M, 3)
or(M, N, 3)
depending on whether the provided spatial points were scalar, 1-D or 2-D, respectively.
Notes
Added in version 0.4.0.