# Tag Info

Accepted

### User_Agent argument in Nominatim in GeoPy

User_Agent is an http request header that is sent with each request. Nominatim requires this value to be set to your application name. The goal is to be able to limit the number of requests per ...
• 42.3k
Accepted

### Bulk reverse geocoding with Geopy using built-in rate_limiter

The correct usage of RateLimiter for reverse geocoding would be: from geopy.geocoders import Nominatim from geopy.extra.rate_limiter import RateLimiter geolocator = Nominatim(user_agent="application"...

### Difference between Vincenty and great-circle distance calculations?

My apologies for posting a second answer here, but I taking the opportunity to respond to the request by @craig-hicks to provide accuracy and timing comparisons for various algorithms for computing ...
• 3,281
Accepted

### inaccurate distance measurements in Python

If you inverse the coordinates, it does not work (geopy uses (latitude,longitude) in the WGS84 crs) dublin = (53.33306,-6.24889) liverpool = ( 53.41058,-2.97794) print distance(dublin, liverpool)....
• 55.1k

### What kind of margin of error can I expect in figuring distance?

Pre-Answers The word accuracy carries different meanings in Survey Engineering and in GIS even though both are related. In the former, it is explained here. In the latter, it was discussed here. ...
• 1,722

### Plot a circle with a given radius around points on map using Python

What you want: Create a circle from the center of each marker This can be easily solved with geopandas buffer functions. You can see the description here. #make circle from point new_df = geo_df.copy()...
• 626
Accepted

### Python function to get the co-ordinate pair of a point

The geolocator.reverse() method is expecting a Point obejct or a tuple with two coordinates. However, you are passing redshape, which is a fiona.collection.Collection object with all the features in ...
• 5,998
Accepted

### Get lat-long of US cities and plot them on a map using matplotlib and basemap

I was able to use the API to put together the program I wanted. Here it is: # Draw the locations of cities on a map of the US import matplotlib.pyplot as plt from mpl_toolkits.basemap import Basemap ...
• 269

### When calcuating distance between points on Earth why are my Haversine vs. Geodesic calculations wildy diverging?

There was a matrix algebra error in the Haversine formula. I updated the code in the question. I am getting much better agreement between Haversine and geodesic now: On my actual dataset:
• 223
Accepted

### Having difficulty retrieving city and area names using Geopy (Google V3)

Be careful with your variable names. You're dangerously re-defining the variable c within your list comprehensions. Do this instead: counties = [x['long_name'] for x in c if 'neighborhood' in x['...
• 8,758
Accepted

### Get state but want country in GeoPy and Nominatim

When you try embedding exactly_one=False parameter (by default it is True) into your code, like from geopy.geocoders import Nominatim geolocator = Nominatim(user_agent='[email protected]', timeout=...
• 33.3k
Accepted

### Reverse geocoding of Pandas DataFrame with Lat/Long columns

Here the Nominatim geocoder (free to choose) from the GeoPy geocoding Python library was used, for more details, please check the documentation. Coordinates of point features should be passed as a ...
• 33.3k

### Reverse geocoding of Pandas DataFrame with Lat/Long columns

A solution: from geopy.geocoders import Nominatim locator = Nominatim(user_agent="myGeocoder") print(test) id Latitude Longitude 0 1 30.197535 -97.662015 1 2 34.895699 -82....
• 55.1k
Accepted

### When calcuating distance between points on Earth why are my Haversine vs. Geodesic calculations wildy diverging?

I appreciate your code because it contributes to geodesy, by allowing to make some interesting analyzes in a practical way, regarding spherical approximations for the calculation of length of geodesic ...
• 14.6k

### Difference between Vincenty and great-circle distance calculations?

Whether using vincenty or haversine or the spherical law of cosines, there is wisdom in becoming aware of any potential issues with the code you are planning to use, things to watch out for and ...
Accepted

### Getting output in different language in GeoPy

As per the doc, you can specify the language as a str type in the parameters of the reverse() method. By default it is language=False, that matches the language of the country for which the geocoder ...
• 42.3k
Accepted

### Extracting GPS points inside the region boundary

Use within: Returns a Series of dtype('bool') with value True for each geometry that is within other. from shapely import geometry import geopandas as gpd import pandas as pd file = r'C:\folder\...
• 74.7k
Accepted

### GeoPandas reading coordinates in inverse order

You're passing the coordinates in the wrong order, shapely uses GIS axis order Point(x,y) so use: Point(response.point.longitude, response.point.latitude)
• 67.1k

### ValueError: Columns must be same length as key

pandas is expecting two values (columns) to be returned as you specified two keys ['Latitude', 'Longitude']. However, when there's an exception, e.g. no geocoding result, you only return a single ...
• 67.1k

### Get lat-long of US cities and plot them on a map using matplotlib and basemap

With Python, you could use the geopy module: >>> from geopy.geocoders import Nominatim >>> geolocator = Nominatim() >>> loc = geolocator.geocode("New York, NY") >>>...
• 12.7k

### Difference between Vincenty and great-circle distance calculations?

It appears that the geopy.distance package offers a function "distance()" which defaults to vincenty(). I would recommend using distance() on principle, as it is the package recommendation, in case ...
• 133

### Making ellipse geometry from some known parameters using PostGIS?

I would go with CIRCULARSTRING. You already know the coordinates of start point and end point, and the coordinates for the peak radius can be easily calculated. Thus, the half of your desired ...
• 4,252

### How do I get zipcodes from longitude and latitude on python?

You are passing in the latitude and longitude Series instead of the latitude and longitude column names. import geopy import pandas as pd def get_zipcode(df, geolocator, lat_field, lon_field): ...
• 67.1k
Accepted

### Getting list of result from GeoPy Nominatim

Look at the Taras's answer in Get state but want country in GeoPy and Nominatim: When you try embedding exactly_one=False parameter (by default it is True) into your code And in geopy.geocoders....
• 55.1k

### Reverse geocoding of Pandas DataFrame with Lat/Long columns

The member function reverse() requires a list or tuple for the first parameter. So your line should look something like this: test['address'] = geolocator.reverse((test['Latitude'], test['Longitude']))...
• 14.6k

### Getting "Non-successful status code 502" error when reverse geocoding of large data in GeoPy

Your code looks okay to me. The only thing that I suggest is to wrap your geocoding procedure into a try/except, i.e. from geopy.point import Point def reverse_geocoding(lat, long): point = Point(...
• 33.3k

### How to geocode the polygon of a street, instead of just a point

Google Geocoder doesn't seem to support returning precise polygons. But it does return an approximate bounding box (see https://developers.google.com/maps/documentation/geocoding/requests-geocoding#...

### "ValueError: Point coordinates must be finite." when reverse geocoding in DataFrame using GeoPy

Indeed, as was pointed by @user2856, there is one record that voids the error. This record possesses Nan values in "LATITUDE" and "LONGITUDE" attributes. To see these values apply ...
• 33.3k
1 vote

### Getting "Non-successful status code 502" error when reverse geocoding of large data in GeoPy

An HTTP 502 status implies something went wrong in your internet connection, it's possible you exceeded some limit on the geocoder.
• 82.1k
1 vote

### Three different distance values, which one should I use?

Your "delta" distance calculation is essentially using the Pythagorean theorem to compute distances. This works on a plane, but the distances you want to calculate are on the curved Earth's ...
• 3,846

Only top scored, non community-wiki answers of a minimum length are eligible