tools.coordinate.projection

piperabm.tools.coordinate.projection.latlong_xy.latlong_xy(latitude_0: float = 0.0, longitude_0: float = 0.0, latitude: float = 0.0, longitude: float = 0.0) tuple[float, float]

Convert geographic coordinates to Cartesian (x, y) using a Mercator projection around a specified origin.

Parameters:
  • latitude_0 (float) – Latitude of the projection origin, in degrees.

  • longitude_0 (float) – Longitude of the projection origin, in degrees.

  • latitude (float) – Latitude of the point to project, in degrees.

  • longitude (float) – Longitude of the point to project, in degrees.

Returns:

A tuple (x, y) of projected coordinates in meters.

Return type:

tuple(float, float)

piperabm.tools.coordinate.projection.latlong_xy.xy_latlong(latitude_0: float = 0.0, longitude_0: float = 0.0, x: float = 0.0, y: float = 0.0) tuple[float, float]

Convert Cartesian (x, y) back to geographic coordinates around a specified origin using the inverse Mercator projection.

Parameters:
  • latitude_0 (float) – Latitude of the projection origin, in degrees.

  • longitude_0 (float) – Longitude of the projection origin, in degrees.

  • x (float) – X coordinate in meters relative to the projection origin.

  • y (float) – Y coordinate in meters relative to the projection origin.

Returns:

A tuple (latitude, longitude) of geographic coordinates in degrees.

Return type:

tuple(float, float)