I am new to working with Maps and search algorithms. Currently I am using geopy
package to get distances from Nominatim
from geopy.geocoders import Nominatim
from geopy.distance import vincenty
nom = Nominatim()
chicago = nom.geocode("chicago")
dallas = nom.geocode("dallas")
chicago_gps = (chicago.latitude, chicago.longitude)
dallas_gps = (dallas.latitude, dallas.longitude)
distance = vincenty(chicago_gps, dallas_gps).km
print('Distance in kms: {}'.format(distance))
print(chicago.raw)
output
Distance in kms: 1294.7623005649557
{'lat': '41.8755546', 'osm_id': '122604', 'boundingbox': ['41.643919', '42.0230219', '-87.940101', '-87.5239841'], 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. http://www.openstreetmap.org/copyright', 'lon': '-87.6244212', 'place_id': '178038280', 'class': 'place', 'icon': 'https://nominatim.openstreetmap.org/images/mapicons/poi_place_city.p.20.png', 'osm_type': 'relation', 'importance': 0.29566190262222, 'display_name': 'Chicago, Cook County, Illinois, United States of America', 'type': 'city'}
So for each place I can calculate the distance. Now there are few questions
- Is it an airline distance ? Also does OSM provide duration of the journey like Google does ?
- How can I get directions if I want to go from "Chicago" to "Dallas" like google ? Is there way we get the routing directly from OSM apart from using APIs MapQuest etc ?
- How can we implement traffic layers in our model ? I need some good resources in that and if there are any python implementations of that it would be great.