0

I have two columns df['latitude'] and df['longitude'] and I am trying to reverse geocode them into full address in df['Address']. However, I am not very successful. Is there a better way of doing this? I am using Geocoder package.

 df['Address'] = Geocoder.reverse_geocode(df['latitude'], df['longitude'])
1
  • Can you use another API like Google Maps? Or look at this: Reverse Geocoder Commented Oct 27, 2017 at 1:16

2 Answers 2

2

you could try something like this out, if Geocoder is working for you:

df['address'] = df.apply(lambda row: Geocoder.reverse_geocode(row['latitude'],row['longitude']),axis=1)

If not, I would recommend another API as @Mokshyam said.

Sign up to request clarification or add additional context in comments.

Comments

0

You can try this if, you want just the country:

df['country'] = df.apply(lambda row: reverse_geocoder.search((row['latitude'],row['longitude']))[0]['cc'],axis=1)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.