Add constructor for the DistanceMatrix class
- `DistanceMatrix.from_addresses()` takes a variable number of `Address` objects and creates distance matrix entries for them - as a base measure, the air distance between two `Address` objects is calculated - in addition, an integration with the Google Maps Directions API is implemented that provides a more realistic measure of the distance and duration a rider on a bicycle would need to travel between two `Address` objects - add a `Location.lat_lng` convenience property that provides the `.latitude` and `.longitude` of an `Address` as a 2-`tuple`
This commit is contained in:
parent
5e9307523c
commit
db715edd6d
6 changed files with 559 additions and 3 deletions
|
|
@ -7,7 +7,7 @@ from typing import Optional, Tuple
|
|||
import utm
|
||||
|
||||
|
||||
class Location:
|
||||
class Location: # noqa:WPS214
|
||||
"""A location represented in WGS84 and UTM coordinates.
|
||||
|
||||
WGS84:
|
||||
|
|
@ -67,6 +67,11 @@ class Location:
|
|||
"""
|
||||
return self._longitude
|
||||
|
||||
@property
|
||||
def lat_lng(self) -> Tuple[float, float]:
|
||||
"""The `.latitude` and `.longitude` as a 2-`tuple`."""
|
||||
return (self._latitude, self._longitude)
|
||||
|
||||
@property
|
||||
def easting(self) -> int:
|
||||
"""The easting of the location in meters (UTM)."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue