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
2
votes
1 answer

How to get the continent given the coordinates (latitude and longitude) in Python?

Is there a method that allows to get the continent where it is in place given its coordinates (without an API key)? I'm using: from geopy.geocoders import Nominatim geolocator = Nominatim(user_agent='...') location = geolocator.reverse('51.0456448,…
LJG
  • 601
  • 1
  • 7
  • 15
2
votes
1 answer

geopy.distance.geodesic() but it says TypeError: unsupported operand type(s) for +=: 'int' and 'tuple'

I'm new and don't understand things. I want to make a new list of distances between every coordinates I have, a list of the distances of point1-point2, point1-point3, point2-point3. so my code is: list_of_coords = [(5.55, 95.3175), (3.583333,…
Zel
  • 23
  • 4
2
votes
1 answer

get country from Nominatim GeoPy response

When using NOminatim with GeoPy to encode given address strings, how does one get the country information? Is there any structured way to get the country name in the output? One way is to take the string after the last "," to get the country, but…
Sid
  • 253
  • 1
  • 17
2
votes
0 answers

How do I use Geopy to get zip code from coordinates for a big dataframe

I have a dataframe of about 750,000 rows. I have longitude and latitude in 2 different columns. I want to use geopy to get the zip code for each row. My current code keeps running for an hour, no end in sight so far. Is there a way to do this…
karan88k
  • 21
  • 1
2
votes
2 answers

Identify US county from from latitude and longitude using Python

I am using the codes below to identify US county. The data is taken from Yelp which provides lat/lon coordinate. id latitude longitude 1 40.017544 -105.283348 2 45.588906 -122.593331 import pandas df =…
2
votes
3 answers

Convert float to string without losing information - Python

I am trying to use geopy to reverse fetch location deatils based off of location coordinates. Right now I have Lat and Long in two different columns in pandas and both are of float type. Now to use locator.reverse(''), the input must be a string.…
2
votes
3 answers

Getting a specific part from a python string

In Geopy, whenever I print the location for example from geopy.geocoders import Nominatim geolocator = Nominatim(user_agent="TTT") location = geolocator.geocode("Washington") print(location.raw) I get the result like this --> Washington, District…
Armaghan
  • 21
  • 3
2
votes
2 answers

Find the dealer nearest to the given customer location when the dealer data set has 25k+ records and customer has 200k+ records using Python

I have two tables - Dealers and Customers. For each of the customer location from the customer table, I need to find the closest located dealer from the dealer table. I have a code that works but takes a few hours to run. I need help in optimizing…
2
votes
2 answers

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

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 =…
IguanaBot
  • 23
  • 1
  • 5
2
votes
2 answers

How can I increase DataFrame's apply function efficiency?

I know it is kinds of impossible but I still look forward to an alternative. Here is my DataFrame (read from csv file): I need to recognize the country and continent where the location is, and here is my idea: import pandas as pd ! pip install…
Memphis Meng
  • 1,267
  • 2
  • 13
  • 34
2
votes
2 answers

Is there a faster way than for loops and if statements to find nearest point to another point in python?

Is there a faster way (in Python, with a CPU) of doing the same thing as the function below? I've used For loops and if statements and wondering if there is a faster way? It currently takes about 1 minute per 100 postcodes to run this function, and…
code_to_joy
  • 569
  • 1
  • 9
  • 27
2
votes
0 answers

Nominatim Returns a Configuration Error after Assigning a Variable to it

I recently downloaded geopy and tested it out on Jupyter's notebook with the code below. import geopy from geopy.geocoders import Nominatim nom=Nominatim(scheme="http") After running this I received the following…
AlePouroullis
  • 333
  • 2
  • 12
2
votes
1 answer

How to find coordinates from a list of addresses in a dataframe

I am trying to create 2 columns in my dataframe for Longitude and Latitude which I want to find by using my address column called 'Details'. I have tried from geopy.extra.rate_limiter import…
AmyZK
  • 21
  • 2
2
votes
1 answer

Error 502 while trying to use geopy and ArcGIS

So I keep running into an issue where my code gets a HTTP Error 502:Bad Gateway. I have essentially the same code that works fine, just with a smaller data file. Is it just the amount of data that is messing it up or have I created another issue.…
hobonomo
  • 31
  • 3
2
votes
2 answers

geopy wont return proper coordinates for canadian postal codes

I am trying to convert Canadian Postal codes into lat, long coordinates however geopy returns them as either none or somewhere in a different country postal_code = "A1B 2C3" #<-- in this format location =…
Z.Chen
  • 385
  • 1
  • 3
  • 13