0
votes

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'])
2
Can you use another API like Google Maps? Or look at this: Reverse Geocoder - skrubber

2 Answers

2
votes

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.

0
votes

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)