I'm doing some webscraping where I get a list of locations. I want to try and convert these to their respective longitude and latitude coordinates. I found geopy
which looks like it does the right stuff.
With or without geopy
, how can I convert this list to their respective coordinates (lon: (from -180,180) and lat: (from -90,90))
from within Python 3.5
?
Preferably precise coordinates but if not possible, general area coordinates would work as well.
I found this resource that I was trying to mimic https://pypi.python.org/pypi/geopy
#Convert to Longitude/Latitude
from geopy.geocoders import Nominatim
geolocator = Nominatim()
locations = ['Kahekili Beach/Old Airport Beach, Leeward Shore Maui', 'Outside Honokohau Harbor South / Naia / Ripoff Reef, North Kona Coast', 'Ulua Beach, Leeward Shore Maui', 'Kaiwi Pt./Arch Cave/Wash Rock/Sand Channel/Kamanu/Devils Doorway, North Kona Coast', 'Honolua Bay MLCD, Leeward Shore Maui', 'Golden Arches', 'Lone Tree Arch / Freeze Face Cave, North Kona Coast', 'Old Airport', 'Turtle Heaven, North Kona Coast', 'Turtle Pinnacle/Turtle Towers/North of Honokohau Harbor Entrance/Terrapin Station/Turtle Pai, North Kona Coast']
for location in locations:
location = geolocator.geocode(location)
Error
+Service timed out