utils.CoordinateTransformer#

class seismostats.utils.CoordinateTransformer(local_proj: int | str, ref_easting: float = 0.0, ref_northing: float = 0.0, ref_altitude: float = 0.0, external_proj: int | str = 4326, ref_proj: int | str | None = None)#

Class to transform between a external geographic (default ESPG:4326, also known as WGS84), and a local cartesian CRS.

Any EPSG code or proj4 string can be used for the local_proj input, for instance 2056 to represent the swiss coordinate system, or “+proj=utm +zone=32 +ellps=WGS84 +datum=WGS84 +units=m +no_defs” to represent a UTM coordinate system.

It is possible to pass a reference point, which will be used as the origin of the local coordinate system. If no reference point is passed, the origin will be set to (0, 0, 0). The projection of the reference point is assumed to be the same as the local projection, unless specified otherwise in the ref_proj kwarg.

Notes

4326 as well as eg 2056 are 2D coordinate systems, so altitude is not taken into account and only calculated in reference to the ref.

Methods

from_local_coords

Transform local coordinates to geographic coordinates.

polygon_from_local_coords

Transform polygon from local coordinates to geographic coordinates.

polygon_to_local_coords

Transform polygon from geographic coordinates to local coordinates.

to_local_coords

Transform geographic coordinates to local coordinates.