diff --git a/osrmareas/areas.py b/osrmareas/areas.py index a97f5ae..2079550 100644 --- a/osrmareas/areas.py +++ b/osrmareas/areas.py @@ -3,6 +3,9 @@ import geopandas as gpd, numpy as np from shapely.geometry import LineString, Point from shapely.geometry import Polygon +import geopy.distance + +ecl_dist = geopy.distance.geodesic crs_moll='EPSG:3857' crs_lat='EPSG:4326' @@ -41,7 +44,9 @@ def get_osrm_route(from_, to_, how='driving'): # route.append([-66.744416, -54.975603])dd line = gpd.GeoDataFrame(geometry=[LineString(route)]).set_crs(crs_lat) line = line.assign( - dist_driving_km=dist/1000, dest_lon = to_[0], dest_lat = to_[1], + dist_driving_km=dist/1000, + dist_eucl_km = ecl_dist((to_[0], to_[1]), (from_[0], from_[1])).km, #euclidean distance + dest_lon = to_[0], dest_lat = to_[1], origin_lon = from_[0], origin_lat = from_[1] ) return line diff --git a/requirements.txt b/requirements.txt index 9ed88f4..6ba1255 100644 --- a/requirements.txt +++ b/requirements.txt @@ -4,4 +4,5 @@ geopandas alphashape shapely tqdm -twine \ No newline at end of file +twine +geopy \ No newline at end of file diff --git a/setup.py b/setup.py index c5d9285..d2ddb8c 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,8 @@ 'geopandas', 'alphashape', 'shapely', - 'tqdm' + 'tqdm', + 'geopy' ], long_description=''' Using OSRM to create areas and routes within a radius.