nominatim icon indicating copy to clipboard operation
nominatim copied to clipboard

'reverse_base' variable not found

Open dp1900 opened this issue 7 years ago • 4 comments

@hrbrmstr @Robinlovelace @rCarto @leeper @calligross

First of all this is a great alternative to Google revgeocode so thank you for working on this. Just have a few minor issues. See below: I would appreciate you guys helping me on this.

I've encountered this issue when I ran the reverse_geocode function:

reverse_geocode <- function(params) {

tryCatch({

res <- GET(reverse_base, query=params, timeout(getOption("NOMINATIM.TIMEOUT")))
stop_for_status(res)

ret <- content(res)

if (length(ret) == 0) return(NULL)

ret_names <- intersect(names(ret),
                   c("place_id", "licence", "osm_type", "osm_id",
                     "lat", "lon", "display_name", "class", "type", "importance"))
tmp_df <- data.frame(t(sapply(ret_names, function(x) { ret[[x]] })), stringsAsFactors=FALSE)

if ("address" %in% names(ret)) {
  tmp_df <- cbind.data.frame(tmp_df,
                         data.frame(t(sapply(names(ret[["address"]]),
                                             function(x) { ret[["address"]][[x]]} )),
                                    stringsAsFactors=FALSE),
                         stringsAsFactors=FALSE)
}

tmp_df$lat <- as.numeric(tmp_df$lat)
tmp_df$lon <- as.numeric(tmp_df$lon)

return(tmp_df)

}, error=function(e) { message("Error connecting to geocode service", e)})

return(NULL)

}

RESPONSE

 |                                                  | 0 % ~calculating Error connecting to geocode serviceError in GET(reverse_base, query = 
params, timeout(getOption("NOMINATIM.TIMEOUT"))): object 'reverse_base' not 
found
|++++++                                            | 11% ~00s          Error connecting to geocode serviceError in 
GET(reverse_base, query = params, timeout(getOption("NOMINATIM.TIMEOUT"))): object 
'reverse_base' not found

|++++++++++++                                      | 22% ~00s          Error connecting to geocode serviceError 
in GET(reverse_base, query = params, timeout(getOption("NOMINATIM.TIMEOUT"))): object 
reverse_base' not found

|+++++++++++++++++                                 | 33% ~00s          Error connecting to geocode 
 serviceError in GET(reverse_base, query = params, timeout(getOption("NOMINATIM.TIMEOUT"))): 
object ' reverse_base' not found

|+++++++++++++++++++++++                           | 44% ~00s          Error connecting to geocode 
serviceError in GET(reverse_base, query = params, timeout(getOption("NOMINATIM.TIMEOUT"))): 
object 'reverse_base' not found

|++++++++++++++++++++++++++++                      | 56% ~00s          Error connecting to 
geocode serviceError in GET(reverse_base, query = params, 
timeout(getOption("NOMINATIM.TIMEOUT"))): object 'reverse_base' not found

|++++++++++++++++++++++++++++++++++                | 67% ~00s          Error connecting to 
geocode serviceError in GET(reverse_base, query = params, 
timeout(getOption("NOMINATIM.TIMEOUT"))): object 'reverse_base' not found

|+++++++++++++++++++++++++++++++++++++++           | 78% ~00s          Error connecting 
to geocode serviceError in GET(reverse_base, query = params, 
timeout(getOption("NOMINATIM.TIMEOUT"))): object 'reverse_base' not found

|+++++++++++++++++++++++++++++++++++++++++++++     | 89% ~00s          Error 
connecting to geocode serviceError in GET(reverse_base, query = params, 
timeout(getOption("NOMINATIM.TIMEOUT"))): object 'reverse_base' not found

|++++++++++++++++++++++++++++++++++++++++++++++++++| 100% elapsed = 00s

It's looking for the reverse_base variable definition in the GET statement and I can't seem to find it. Please assist. Thanks.

dp1900 avatar Sep 24 '18 13:09 dp1900

Have you tried the revgeo package? I can recommend it. Demo of it in action (we recently switched to it): http://geocompr.robinlovelace.net/location.html#define-metropolitan-areas

Robinlovelace avatar Sep 25 '18 07:09 Robinlovelace

This is excellent!!! Just ran the revgeo package using the embassies coordinates, it works excellent and I used photon as the provider and I like the output = "frame" because it separates each element (house num, street, city, etc) into columns. By the way, is there a limit on query using photon? I've acquired a MapQuest API, and correct me if I'm wrong but it shows 15K/month limit?Is the API applicable here when using photon provider? Again, thanks much. Appreciate the recommendation. Also I like the paper posted on the link about Geomarketing!

addresses <- revgeo(longitude =  embassies$lon, latitude = embassies$lat, provider = "photon",+                     API = NULL, output = "frame")[1] "Getting geocode data from Photon: http://photon.komoot.de/reverse?lon=69.1835&lat=34.53311"[1] "Getting geocode data from Photon: http://photon.komoot.de/reverse?lon=19.818698&lat=41.327546"[1] "Getting geocode data from Photon: http://photon.komoot.de/reverse?lon=12.50891&lat=41.91534"[1] "Getting geocode data from Photon: http://photon.komoot.de/reverse?lon=3.0166&lat=36.76148"[1] "Getting geocode data from Photon: http://photon.komoot.de/reverse?lon=-171.76462&lat=-13.83282"[1] "Getting geocode data from Photon: http://photon.komoot.de/reverse?lon=-3.686115&lat=40.479094"[1] "Getting geocode data from Photon: http://photon.komoot.de/reverse?lon=31.043559&lat=-17.820705"[1] "Getting geocode data from Photon: http://photon.komoot.de/reverse?lon=-59.59998&lat=13.09511"[1] "Getting geocode data from Photon: http://photon.komoot.de/reverse?lon=-59.59998&lat=13.09511"> head(addresses)             housenumber           street       city               state                zip     country1 House Number Not Found     Torabaz Khan      Kabul               Kabul               0093 Afghanistan2 House Number Not Found      Rruga Tafaj     Tiranë     Central Albania               1000     Albania3 House Number Not Found Street Not Found       Rome               Lazio              00157       Italy4 House Number Not Found Street Not Found Ben Aknoun             Algiers              16000     Algeria5 House Number Not Found    Mulinu'u Road       Apia     State Not Found Postcode Not Found       Samoa6 House Number Not Found Street Not Found     Madrid Community of Madrid              28001       Spain

On Tuesday, September 25, 2018 12:22 AM, Robin <[email protected]> wrote:

Have you tried the revgeo package? I can recommend it. Demo of it in action (we recently switched to it): http://geocompr.robinlovelace.net/location.html#define-metropolitan-areas— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

dp1900 avatar Sep 25 '18 14:09 dp1900

Great. Not sure about API limits with Photon. Glad the chapter was of use. Any comments/suggestions on that welcome!

Robinlovelace avatar Sep 25 '18 15:09 Robinlovelace

late on this but I just re-connected my mapquest account and tried this and it worked.

however, i moved the internal globals to a new aaa.R (which shouldn't have been an issue but ¯_(ツ)_/¯)

hrbrmstr avatar Oct 01 '18 11:10 hrbrmstr