0

I found this question about converting a longitude and latitude into an address. The question uses ggmap's revgeocode which uses the google API. If I understood correctly, this is very costly.

I noticed that the following link about Accessing OpenStreetMap data with R, also uses ggmap. I was wondering if it is possible to use open street maps for revgeocode instead of the google API, or whether there is some other way to use OpenStreetMap to reverse geocode.

Data used for question:

humandate           lat         lon     
09/10/2014 13:41    41.83174254 -75.87998774    
09/10/2014 13:53    41.83189873 -75.87994957

Answer provided:

library(ggmap)
revgeocode(c(df$lon[1], df$lat[1]))

"27-37 Beech Street, Montrose, PA 18801, USA"

I found an answer for the API here, and I found this package is available in R: tmaptools.

I tried to do the following, but to no avail:

address <- tmaptools::rev_geocode_OSM(41.83174254 , -75.87998774)

Error in names(search_result_id) <- c("place_id", "osm_type", "osm_id",  : 
  attempt to set an attribute on NULL
Tom
  • 2,173
  • 1
  • 17
  • 44

0 Answers0