Questions tagged [geopy]

geopy allows you to convert between partial place names and latitude/longitude coordinates by wrapping many different online API's and providing access through one standard interface.

geopy allows you to convert between partial place names and latitude/longitude coordinates by wrapping many different online API's and providing access through one standard interface. Additionally, it contains convenience functions for parsing lat/long coordinates and finding as-the-crow-flies distance between them.

geopy makes it easy for developers to locate the coordinates of addresses, cities, countries, and landmarks across the globe using third-party geocoders and other data sources.

geopy includes support for many geocoders such as Google Maps, Bing Maps, Nominatim, and GeoNames.

504 questions
29
votes
3 answers

Python module for getting latitude and longitude from the name of a US city

I am looking for a python module which can take in the name of the city as the input and return the latitude and longitude of the input.
Deepak B
  • 2,245
  • 5
  • 26
  • 28
26
votes
4 answers

Geopy: catch timeout error

I am using geopy to geocode some addresses and I want to catch the timeout errors and print them out so I can do some quality control on the input. I am putting the geocode request in a try/catch but it's not working. Any ideas on what I need to do?…
MoreScratch
  • 2,933
  • 6
  • 34
  • 65
18
votes
2 answers

new column with coordinates using geopy pandas

I have a df: import pandas as pd import numpy as np import datetime as DT import hmac from geopy.geocoders import Nominatim from geopy.distance import vincenty df city_name state_name county_name 0 WASHINGTON DC DIST OF COLUMBIA 1 …
Dave
  • 6,968
  • 7
  • 26
  • 32
18
votes
3 answers

Calculate point based on distance and direction

I would like to calculate a point based on direction and distance using GeoDjango or GeoPy. For example, If I have a point that is (-24680.1613, 6708860.65389) I would like to find out a point 1KM North, 1KM East, 1KM Sourh and 1KM west using…
LondonAppDev
  • 8,501
  • 8
  • 60
  • 87
14
votes
1 answer

How can I generate a regular geographic grid using python?

I want to retrieve all lat/lon coordinate pairs of a regular grid over a certain map area. I have found the geopy library, but didn't manage at all to approach the problem. For example, I have a rectangular geographic area described by its four…
Amira Akhdal
  • 161
  • 1
  • 1
  • 5
14
votes
3 answers

ImportError: No module named 'geopy' ipython-notebook

currently I need to make some distance calculation. For this I am trying the following on my ipython-notebook (version 4.0.4): from geopy.distance import vincenty ig_gruendau = (50.195883, 9.115557) delphi =…
user5446609
  • 174
  • 1
  • 1
  • 7
12
votes
4 answers

Return individual address components (city, state, etc.) from GeoPy geocoder

I'm using GeoPy to geocode addresses to lat,lng. I would also like to extract the itemized address components (street, city, state, zip) for each address. GeoPy returns a string with the address -- but I can't find a reliable way to separate each…
lubar
  • 2,589
  • 2
  • 26
  • 28
11
votes
1 answer

Why can't I import geopy.distance.vincenty() on Jupyter Notebook? I installed geopy 2.0.0

from geopy.distance import vincenty I just installed the geopy package 2.0.0, I want to use geopy.distance.vincenty() as this doc says. However, it returns ImportError: cannot import name 'vincenty' from 'geopy.distance'. And if I try from geopy…
Paw in Data
  • 1,262
  • 2
  • 14
  • 32
11
votes
2 answers

error (429) Too Many Requests while geocoding with geopy in Python

I have a Pandas dataframe with ~20k rows, and I am trying to geocode by address column into lat/long coordinates. How do I use time.sleep() or maybe other function to stop OSM Nominatim from Too Many Requests 429 error that I am getting now? Here's…
seizethedata
  • 130
  • 1
  • 1
  • 8
11
votes
2 answers

Process request thread error with Flask Application?

This might be a long shot, but here's the error that i'm getting: File "/home/MY NAME/anaconda/lib/python2.7/SocketServer.py", line 596, in process_request_thread self.finish_request(request, client_address) File "/home/MY…
Harrison
  • 5,095
  • 7
  • 40
  • 60
10
votes
4 answers

How to use Vectorization with NumPy arrays to calculate geodesic distance using Geopy library for a large dataset?

I am trying to calculate geodesic distance from a dataframe which consists of four columns of latitude and longitude data with around 3 million rows. I used the apply lambda method to do it but it took 18 minutes to finish the task. Is there a way…
Edwin Leung
  • 111
  • 1
  • 5
10
votes
3 answers

Calculating distance between *multiple* sets of geo coordinates in python

I am struggling to calculate the distance between multiple sets of latitude and longitude coordinates. In, short, I have found numerous tutorials that either use math or geopy. These tutorials work great when I just want to find the distance…
Colin
  • 101
  • 1
  • 1
  • 4
10
votes
3 answers

Can I get the altitude with geopy in Python? (with Longitude/Latitude)

it is possible? i tryed: from geopy.point import Point from geopy import geocoders [...] p = Point(Latitude, Longitude) lat, lon, altitude = p height_metres = altitude but height_metres is always 0.
Sven Wiesel
  • 101
  • 1
  • 1
  • 3
9
votes
4 answers

Normalizing street addresses in Django/Python

I have a Django form where one of the fields is a TextInput for a street address. I want to normalize the data. For example: >> normalize('420 East 24th St.') '420 E. 24th Street' >> normalize('221 Amsterdam Av') '221 Amsterdam Ave.' >>…
Belmin Fernandez
  • 8,307
  • 9
  • 51
  • 75
9
votes
1 answer

Geopy: retrieving country names in English

I am trying to reverse geocode coordinates and retrieve corresponding country codes using geopy. However, Geopy does not seem to provide a method for fetching country codes. So, I am trying to retrieve country names first, and then convert them to…
ApplePi
  • 93
  • 2
  • 4
1
2 3
33 34