Add DistanceMatrix class
- the class stores the data of a distance matrix between all addresses + air distances + bicycle distances - in addition, the "path" returned by the Google Directions API are also stored as a JSON serialized sequence of latitude-longitude pairs - we assume a symmetric graph
This commit is contained in:
parent
28368cc30a
commit
cc75307e5a
7 changed files with 442 additions and 2 deletions
|
|
@ -57,6 +57,16 @@ class Address(meta.Base):
|
|||
|
||||
# Relationships
|
||||
city = orm.relationship('City', back_populates='addresses')
|
||||
_distances1 = orm.relationship(
|
||||
'DistanceMatrix',
|
||||
back_populates='first_address',
|
||||
foreign_keys='[DistanceMatrix.first_address_id, DistanceMatrix.city_id]',
|
||||
)
|
||||
_distances2 = orm.relationship(
|
||||
'DistanceMatrix',
|
||||
back_populates='second_address',
|
||||
foreign_keys='[DistanceMatrix.second_address_id, DistanceMatrix.city_id]',
|
||||
)
|
||||
restaurants = orm.relationship('Restaurant', back_populates='address')
|
||||
orders_picked_up = orm.relationship(
|
||||
'Order',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue