xiaochuan fang
xiaochuan fang

Reputation: 114

Unknown issue prevents geocode_reverse from working

I recently update RStudio to the version RStudio 2022.07.1, working on Windows 10. When I tried different geocode reverse functions(Which is input coordinate, output is the address), they all return no found. Example 1:

library(revgeo)
revgeo(-77.016472, 38.785026)

Suppose return "146 National Plaza, Fort Washington, Maryland, 20745, United States of America". But I got

"Getting geocode data from Photon: http://photon.komoot.de/reverse?lon=-77.016472&lat=38.785026"
[[1]]
[1] "House Number Not Found Street Not Found, City Not Found, State Not Found, Postcode Not Found, Country Not Found"

Data from https://github.com/mhudecheck/revgeo

Example 2:

library(tidygeocoder)
library(dplyr)

path <- "filepath"
df <- read.csv (paste (path, "sample.csv", sep = ""))
reverse <- df %>%
  reverse_geocode(lat = longitude, long = latitude, method = 'osm',
                address = address_found, full_results = TRUE)
reverse

Where the sample.csv is

name addr latitude longitude
White House 1600 Pennsylvania Ave NW, Washington, DC 38.89770 -77.03655
Transamerica Pyramid 600 Montgomery St, San Francisco, CA 94111 37.79520 -122.40279
Willis Tower 233 S Wacker Dr, Chicago, IL 60606 41.87535 -87.63576

Suppose to get

name addr latitude longitude address_found
White House 1600 Pennsylvania Ave NW, Washington, DC 38.89770 -77.03655 White House, 1600, Pennsylvania Avenue Northwest, Washington, District of Columbia, 20500, United States
Transamerica Pyramid 600 Montgomery St, San Francisco, CA 94111 37.79520 -122.40279 Transamerica Pyramid, 600, Montgomery Street, Chinatown, San Francisco, San Francisco City and County, San Francisco, California, 94111, United States
Willis Tower 233 S Wacker Dr, Chicago, IL 60606 41.87535 -87.63576 South Wacker Drive, Printer’s Row, Loop, Chicago, Cook County, Illinois, 60606, United States

But I got

# A tibble: 3 × 5
  name                 addr                            latitude longitude address_found
  <chr>                <chr>                              <dbl>     <dbl> <chr>        
1 White House          1600 Pennsylvania Ave NW, Wash…     38.9     -77.0 NA           
2 Transamerica Pyramid 600 Montgomery St, San Francis…     37.8    -122.  NA           
3 Willis Tower         233 S Wacker Dr, Chicago, IL 6…     41.9     -87.6 NA     

Data source: https://cran.r-project.org/web/packages/tidygeocoder/readme/README.html

However, when I tried

reverse_geo(lat = 38.895865, long = -77.0307713, method = "osm")

I'm able to get

# A tibble: 1 × 3
    lat  long address                                                                  
  <dbl> <dbl> <chr>                                                                    
1  38.9 -77.0 Pennsylvania Avenue, Washington, District of Columbia, 20045, United States

I had contact the tidygeocoder developer, he/she didn't find out any problem. Detail in https://github.com/jessecambon/tidygeocoder/issues/175

Not sure which part goes wrong. Anyone want try on their RStudio?

Upvotes: 1

Views: 254

Answers (1)

Gregor Thomas
Gregor Thomas

Reputation: 145785

The updated revgeo needs to be submitted to CRAN. This has nothing to do with RStudio.

Going to http://photon.komoot.de/reverse?lon=-77.016472&lat=38.785026 in my browser also returns an error. However, I searched for the Photon reverse geocoder, and their example uses .io not .de in the URL, and https://photon.komoot.io/reverse?lon=-77.016472&lat=38.785026 works.

Photon also include a Note at the bottom of their examples:

Until October 2020 the API was available under photon.komoot.de. Requests still work as they redirected to photon.komoot.io but please update your apps accordingly.

Seems like that redirect is either broken or deprecated.

The version of revgeo on github has this change made already, so you can get a working version by using remotes::install_github("https://github.com/mhudecheck/revgeo")

Upvotes: 2

Related Questions