geovista.crs#

Coordinate reference system (CRS) utility functions.

Notes#

Added in version 0.1.0.

Module Contents#

Functions#

from_wkt(mesh)

Get the CRS associated with the mesh.

get_central_meridian(crs)

Retrieve the longitude of natural origin of the CRS.

has_wkt(mesh)

Determine whether the provided mesh has a CRS serialized as WKT attached.

projected(mesh)

Determine if the mesh is a planar projection.

set_central_meridian(crs, meridian)

Replace the longitude of natural origin in the CRS.

to_wkt(mesh, crs)

Attach serialized CRS as Well-Known-Text (WKT) to the mesh.

Attributes#

CRSLike

Type alias for a Coordinate Reference System.

PlateCarree

WGS84 / Plate Carree (Equidistant Cylindrical).

WGS84

Geographic WGS84.

geovista.crs.from_wkt(mesh)[source]#

Get the CRS associated with the mesh.

Parameters:
meshPolyData

The mesh containing the CRS serialized as OGC Well-Known-Text (WKT).

Returns:
CRS

The Coordinate Reference System.

Notes

Added in version 0.1.0.

geovista.crs.get_central_meridian(crs)[source]#

Retrieve the longitude of natural origin of the CRS.

THe natural origin is also known as the central meridian.

Parameters:
crsCRS

The Coordinate Reference System.

Returns:
float

The central meridian, or None if the crs has no such parameter.

Notes

Added in version 0.1.0.

geovista.crs.has_wkt(mesh)[source]#

Determine whether the provided mesh has a CRS serialized as WKT attached.

Parameters:
meshPolyData

The mesh to be inspected for a serialized CRS.

Returns:
bool

Whether the mesh has a CRS serialized as WKT attached.

Notes

Added in version 0.4.0.

geovista.crs.projected(mesh)[source]#

Determine if the mesh is a planar projection.

Simple heuristic approach achieved by attempting to inspect the associated CRS of the mesh. If the mesh CRS is unavailable then the weaker contract of inspecting the mesh geometry is used to detect for a flat plane.

Parameters:
meshPolyData

The mesh to be inspected.

Returns:
bool

Whether the mesh is projected.

Notes

Added in version 0.1.0.

geovista.crs.set_central_meridian(crs, meridian)[source]#

Replace the longitude of natural origin in the CRS.

The natural origin is also known as the central meridian.

Note that, the crs is immutable, therefore a new instance will be returned with the specified central meridian.

Parameters:
crsCRS

The Coordinate Reference System.

meridianfloat

The replacement central meridian.

Returns:
CRS or None

The CRS with the specified central meridian, or None if the CRS has no such parameter.

Notes

Added in version 0.1.0.

geovista.crs.to_wkt(mesh, crs)[source]#

Attach serialized CRS as Well-Known-Text (WKT) to the mesh.

The serialized OGC WKT is attached to the field_data of the mesh in-place.

Parameters:
meshPolyData

The mesh to contain the serialized OGC WKT.

crsCRS

The Coordinate Reference System to be serialized.

Notes

Added in version 0.2.0.

geovista.crs.CRSLike: TypeAlias = int | str | dict | CRS#

Type alias for a Coordinate Reference System.

geovista.crs.PlateCarree#

WGS84 / Plate Carree (Equidistant Cylindrical).

geovista.crs.WGS84#

Geographic WGS84.