pandemia.world.location

Module Contents

Classes

Location

Represents a location, for example an area of land or a building.

Functions

ETRS89_to_WGS84(→ LocationTuple)

Convert from ETRS89 grid format to WGS84 lat, lon format.

WGS84_to_ETRS89(→ LocationTuple)

Convert from WGS84 lat, lon format to ETRS89 grid format.

Attributes

LocationTuple

pandemia.world.location.LocationTuple
class pandemia.world.location.Location(typ: str, coord: LocationTuple)

Represents a location, for example an area of land or a building.

Parameters:

typstr

The type of location, as a string. For example “House” or “Restaurant”.

coordtuple

A 2-tuple of floats, representing x, y coordinates.

uuid

A universally unique identifier for this location (str).

typ

The type of location, as a string (str). For example “House” or “Restaurant”.

coord

A 2-tuple of floats, representing x, y coordinates (tuple).

distance_euclidean(other: Location) float

Calculate the Euclidean distance between two locations.

Parameters:

other (Location) – The other location.

Returns:

distance – The Euclidean distance to the other location.

Return type:

float

pandemia.world.location.ETRS89_to_WGS84(coord: LocationTuple) LocationTuple

Convert from ETRS89 grid format to WGS84 lat, lon format.

Parameters:

coord (LocationTuple) – A 2-tuple of floats.

Returns:

new_coord – If coord represents the coordinates of a location in ETRS89 format, then new_coord represents the coordinates of that location in WGS84 format.

Return type:

LocationTuple

pandemia.world.location.WGS84_to_ETRS89(coord: LocationTuple) LocationTuple

Convert from WGS84 lat, lon format to ETRS89 grid format.

Parameters:

coord (LocationTuple) – A 2-tuple of floats.

Returns:

new_coord – If coord represents the coordinates of a location in WGS84 format, then new_coord represents the coordinates of that location in ETRS89 format.

Return type:

LocationTuple