geovista.transform#

Coordinate reference system (CRS) transformation functions.

Notes#

Added in version 0.3.0.

Module Contents#

Functions#

transform_mesh(mesh,Ā tgt_crs[,Ā slice_connectivity,Ā ...])

Transform the mesh from its source CRS to the target CRS.

transform_point(src_crs,Ā tgt_crs,Ā x,Ā y[,Ā z,Ā trap])

Transform the spatial point from the source to the target CRS.

transform_points(src_crs,Ā tgt_crs,Ā xs,Ā ys[,Ā zs,Ā trap])

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

The mesh to be transformed from its source coordinate reference system (CRS) to the given tgt_crs.

tgt_crsCRSLike

The target coordinate reference system (CRS) of the transformation. May be anything accepted by pyproj.crs.CRS.from_user_input().

slice_connectivitybool, 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().

rtolfloat, optional

The relative tolerance for longitudes close to the ā€˜wrap meridianā€™ - see geovista.common.wrap() for more.

atolfloat, optional

The absolute tolerance for longitudes close to the ā€˜wrap meridianā€™ - see geovista.common.wrap() for more.

zlevelint or ArrayLike, 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 the mesh.points.

zscalefloat, optional

The proportional multiplier for z-axis zlevel. Defaults to geovista.common.ZLEVEL_SCALE.

inplacebool, default=False

Update the mesh in-place. Can only perform an in-place operation when slice_connectivity=False.

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_crsCRSLike

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_crsCRSLike

The target Coordinate Reference System (CRS) of the transform for the spatial point. May be anything accepted by pyproj.crs.CRS.from_user_input().

xArrayLike

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.

yArrayLike

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).

zArrayLike, 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).

trapbool, 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.

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_crsCRSLike

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_crsCRSLike

The target Coordinate Reference System (CRS) of the transform for the spatial points. May be anything accepted by pyproj.crs.CRS.from_user_input().

xsArrayLike

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.

ysArrayLike

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.

zsArrayLike, 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.

trapbool, default=True

Raise an exception if an error occurs during CRS transformation of the spatial points. Otherwise, inf will be returned for erroneous points.

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.