Geopy Simple

Sat 17 May 2025

title: "Template" author: "Raja CSP Raman" date: 2019-05-07 description: "-" type: technical_note draft: false


from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="rajarcsp")
location = geolocator.geocode("175 5th Avenue NYC")
location
Location(Flatiron Building, 175, 5th Avenue, Flatiron District, Manhattan, Manhattan Community Board 5, New York County, NYC, New York, 10010, USA, (40.7410861, -73.9896298241625, 0.0))
type(location)
geopy.location.Location
location = geolocator.geocode("Toronto")
location
Location(Toronto, Ontario, M6K 1X9, Canada, (43.653963, -79.387207, 0.0))
def get_lat_lang(city):
    location = geolocator.geocode(city)
    return location.latitude, location.longitude
lat, long = get_lat_lang("Toronto")
lat, long
(43.653963, -79.387207)

  File "<ipython-input-16-a60e00896a16>", line 1
    http://geopandas.org/index.html
          ^
SyntaxError: invalid syntax


Score: 10

Category: geopandas