geopy

Calculate distance between two coordinates for a fixed point in a DataFrame

Calculate distance between two coordinates for a fixed point in a DataFrame Question: I have the following DataFrame in pandas: code latitude longitude 01 40.410323 -3.993046 02 41.490604 1.696572 03 39.287817 -0.435448 04 38.594316 -0.128489 05 36.900799 -3.423063 06 36.541667 -4.625 I want to create a new column called km_to_fixed_coords in which the distance in …

Total answers: 3

ModuleNotFoundError: No module named 'geopy.geocoders'; 'geopy' is not a package

ModuleNotFoundError: No module named 'geopy.geocoders'; 'geopy' is not a package Question: I am using VS and I am trying to run geopy, I installed all the prerequisites and get this error "ModuleNotFoundError: No module named ‘geopy.geocoders’; ‘geopy’ is not a package" from geopy.geocoders import Nominatim geolocator = Nominatim(user_agent="http") location = geolocator.geocode("175 5th Avenue NYC") print(location.address) …

Total answers: 2

Failed geolocalization with Geopy, Nominatim: TypeError: 'NoneType' object is not subscriptable

Failed geolocalization with Geopy, Nominatim: TypeError: 'NoneType' object is not subscriptable Question: I am trying to use module Geopy, function Nominatim to geolocalize a list of addresses (contained inside a CSV file). Here is my code: import pandas as pd from geopy.geocoders import Nominatim df = pd.read_csv(‘incidenti genova 3.csv’, delimiter=’;’, error_bad_lines=False) indirizzi = df.descrizione_strada nom=Nominatim(user_agent="my-application") …

Total answers: 1

How can I generate a regular geographic grid using python?

How can I generate a regular geographic grid using python? Question: 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 …

Total answers: 1

Most straightforward way to cache geocoding data

Most straightforward way to cache geocoding data Question: I am using geopy to get lat/long coordinates for a list of addresses. All the documentation points to limiting server queries by caching (many questions here, in fact), but few actually give practical solutions. What is the best way to accomplish this? This is for a self-contained …

Total answers: 5

Geopy: catch timeout error

Geopy: catch timeout error Question: 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 …

Total answers: 4