0

I used the twitteR package to extract data from Twitter API, and now I try to filter data by country name.

Most geocode packages are designed for inputting the real address and returning the corresponding geocode, but my needs are just the opposite.

For example, when I input c(38.897957, -77.036560), the result is "Whitehouse, D.C., U.S."

R.S.
  • 2,093
  • 14
  • 29
Carlos
  • 167
  • 1
  • 2
  • 14
  • Try this : https://stackoverflow.com/questions/29921605/r-how-to-convert-latitude-and-longitude-coordinates-into-an-address-human-rea – R.S. Oct 09 '20 at 01:09
  • Thank you, R.S. But unfortunately, I find the google maps service is paid for... and it is too expensive for a student. – Carlos Oct 09 '20 at 22:35

1 Answers1

0

I ran into the revgeo package which performs Reverse Geocoding with the Photon Geocoder for OpenStreetMap,Google Maps, and Bing .

By default it uses photon which provides free data.
I'm using the example from the package itself.

require(revgeo)

revgeo(longitude=-77.0229529, latitude=38.89283435)
#"700 Pennsylvania Avenue Northwest, City Not Found, Washington, D.C., 20004, United States of America"

You can give it a try.

This blog below does mention that some locations are missing form their dataset, and it throttles down the speed after certain number of queries. There are other good pointers at the blog. https://towardsdatascience.com/reverse-geocoding-in-r-f7fe4b908355

R.S.
  • 2,093
  • 14
  • 29