co2calculator.distances

Functions for obtaining the distance between given addresses.

Functions

create_distance_request(start, destination, ...)

Transform and validate the user input into a proper model for distance calculations

geocoding(address)

Function to obtain coordinates for a given address

geocoding_airport(iata)

Function to obtain the coordinates of an airport by the IATA code

geocoding_airport_pelias(iata)

Function to obtain the coordinates of an airport by the IATA code

geocoding_structured(loc_dict)

Function to obtain coordinates for a given address

geocoding_train_stations(loc_dict)

Function to obtain coordinates for a given train station

get_distance(request)

Get the distance between start and destination

get_route(coords[, profile])

Obtain the distance of a route between given waypoints using a given profile todo: check if coords may also be a tuple/array etc.

get_route_ferry(coords[, profile])

Obtain the distance of a ferry route (and the total trip distance) between given waypoints todo: check if coords may also be a tuple/array etc.

haversine(lat_start, long_start, lat_dest, ...)

Function to compute the distance as the crow flies between given locations

range_categories(distance)

Function to categorize a trip according to the travelled distance

Classes

Airport(*, iata_code)

Coordinate(*, lat, long[, lat_rad, long_rad])

DistanceRequest(*, transportation_mode, ...)

StructuredLocation(*[, address, country, ...])

TrainStation(*, station_name, country)

Exceptions

InvalidSpatialInput

Raised when consumer inputs invalid spatial information