Closed xiaochuanfang closed 2 years ago
Hi @xiaochuanfang has this happened multiple times? Can you please post the results of devtools::session_info()
?
This is the first time I use tidygeocoder. Not sure something wrong on my side? setting value version R version 4.2.0 (2022-04-22 ucrt) os Windows 10 x64 (build 22000) system x86_64, mingw32 ui RStudio language (EN) collate English_United States.utf8 ctype English_United States.utf8 tz America/New_York date 2022-08-05 rstudio 2022.07.1+554 Spotted Wakerobin (desktop) pandoc NA
─ Packages ────────────────────────────────────────────────────────────────────────── package version date (UTC) lib source assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.2.0) cachem 1.0.6 2021-08-19 [1] CRAN (R 4.2.1) callr 3.7.0 2021-04-20 [1] CRAN (R 4.2.0) cli 3.3.0 2022-04-25 [1] CRAN (R 4.2.0) crayon 1.5.1 2022-03-26 [1] CRAN (R 4.2.0) curl 4.3.2 2021-06-23 [1] CRAN (R 4.2.0) DBI 1.1.3 2022-06-18 [1] CRAN (R 4.2.0) devtools 2.4.4 2022-07-20 [1] CRAN (R 4.2.1) digest 0.6.29 2021-12-01 [1] CRAN (R 4.2.0) dplyr 1.0.9 2022-04-28 [1] CRAN (R 4.2.0) ellipsis 0.3.2 2021-04-29 [1] CRAN (R 4.2.0) fansi 1.0.3 2022-03-24 [1] CRAN (R 4.2.0) fastmap 1.1.0 2021-01-25 [1] CRAN (R 4.2.0) fs 1.5.2 2021-12-08 [1] CRAN (R 4.2.0) generics 0.1.2 2022-01-31 [1] CRAN (R 4.2.0) glue 1.6.2 2022-02-24 [1] CRAN (R 4.2.0) hms 1.1.1 2021-09-26 [1] CRAN (R 4.2.0) htmltools 0.5.2 2021-08-25 [1] CRAN (R 4.2.0) htmlwidgets 1.5.4 2021-09-08 [1] CRAN (R 4.2.1) httpuv 1.6.5 2022-01-05 [1] CRAN (R 4.2.1) httr 1.4.3 2022-05-04 [1] CRAN (R 4.2.0) jsonlite 1.8.0 2022-02-22 [1] CRAN (R 4.2.0) later 1.3.0 2021-08-18 [1] CRAN (R 4.2.1) lifecycle 1.0.1 2021-09-24 [1] CRAN (R 4.2.0) magrittr 2.0.3 2022-03-30 [1] CRAN (R 4.2.0) memoise 2.0.1 2021-11-26 [1] CRAN (R 4.2.1) mime 0.12 2021-09-28 [1] CRAN (R 4.2.0) miniUI 0.1.1.1 2018-05-18 [1] CRAN (R 4.2.1) pillar 1.7.0 2022-02-01 [1] CRAN (R 4.2.0) pkgbuild 1.3.1 2021-12-20 [1] CRAN (R 4.2.1) pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.2.0) pkgload 1.3.0 2022-06-27 [1] CRAN (R 4.2.1) prettyunits 1.1.1 2020-01-24 [1] CRAN (R 4.2.0) processx 3.6.1 2022-06-17 [1] CRAN (R 4.2.0) profvis 0.3.7 2020-11-02 [1] CRAN (R 4.2.1) progress 1.2.2 2019-05-16 [1] CRAN (R 4.2.0) promises 1.2.0.1 2021-02-11 [1] CRAN (R 4.2.1) ps 1.7.1 2022-06-18 [1] CRAN (R 4.2.0) purrr 0.3.4 2020-04-17 [1] CRAN (R 4.2.0) R6 2.5.1 2021-08-19 [1] CRAN (R 4.2.0) Rcpp 1.0.8.3 2022-03-17 [1] CRAN (R 4.2.0) remotes 2.4.2 2021-11-30 [1] CRAN (R 4.2.1) rlang 1.0.4 2022-07-12 [1] CRAN (R 4.2.1) rstudioapi 0.13 2020-11-12 [1] CRAN (R 4.2.0) sessioninfo 1.2.2 2021-12-06 [1] CRAN (R 4.2.1) shiny 1.7.2 2022-07-19 [1] CRAN (R 4.2.1) stringi 1.7.6 2021-11-29 [1] CRAN (R 4.2.0) stringr 1.4.0 2019-02-10 [1] CRAN (R 4.2.0) tibble 3.1.7 2022-05-03 [1] CRAN (R 4.2.0) tidygeocoder 1.0.5 2021-11-02 [1] CRAN (R 4.2.1) tidyselect 1.1.2 2022-02-21 [1] CRAN (R 4.2.0) urlchecker 1.0.1 2021-11-30 [1] CRAN (R 4.2.1) usethis * 2.1.6 2022-05-25 [1] CRAN (R 4.2.1) utf8 1.2.2 2021-07-24 [1] CRAN (R 4.2.0) vctrs 0.4.1 2022-04-13 [1] CRAN (R 4.2.0) xtable 1.8-4 2019-04-21 [1] CRAN (R 4.2.0)
[1] C:/Users/xiaoc/AppData/Local/R/win-library/4.2 [2] C:/Program Files/R/R-4.2.0/library
Code: data <- read.csv (paste (path, "sample2.csv", sep = "")) reverse <- data %>% reverse_geocode(lat = longitude, long = latitude, method = 'osm', address = address_found, full_results = TRUE) reverse
Sample2.csv: name | addr | latitude | longitude White House | 1600 Pennsylvania Ave NW, Washington, DC | 38.8977 | -77.03655 Transamerica Pyramid | 600 Montgomery St, San Francisco, CA 94111 | 37.7952 | -122.4028 Willis Tower | 233 S Wacker Dr, Chicago, IL 60606 | 41.8754 | -87.63576
R script result:
name addr latitude longitude address_found
Hmm I don't notice any obvious issues with your package versions. What happens if you run this?
reverse_geo(lat = 38.895865, long = -77.0307713, method = "osm")
See expected results in the examples here: https://jessecambon.github.io/tidygeocoder/reference/reverse_geo.html
You could also try to update all your packages to see if that resolves the issue.
I'm able to get A tibble: 1 × 3 lat long address
Hi @xiaochuanfang were you able to get this working? If so, what was the solution?
No, I can't get it work. So I'm going work with the reverse_geo function from the tidygeocoder. You also facing the same problem too?
No I wasn't able to reproduce your issue. You are able to get results with reverse_geo but not reverse_geocode? With the same inputs?
Same input but reverse_geo worked while reverse_geocode doesn't work for me. csv: | latitude | longitude | address |
---|---|---|---|
38.895865 | -77.0307713 |
Code: sample <- read.csv (paste (path, "sample3.csv", sep = "")) reverse <- sample %>% reverse_geocode(lat = longitude, long = latitude, method = 'osm', address = address_found, full_results = TRUE) reverse
Result:
latitude longitude address address_found
That is odd. Are you able to run the examples in the reverse_geocode documentation?
https://jessecambon.github.io/tidygeocoder/reference/reverse_geocode.html
library(tibble)
library(dplyr, warn.conflicts = FALSE)
tibble(
latitude = c(38.895865, 43.6534817),
longitude = c(-77.0307713, -79.3839347)
) %>%
reverse_geocode(
lat = latitude,
long = longitude,
method = "osm",
full_results = TRUE
)
I think this one works:
latitude longitude address place_id licence osm_type osm_id osm_lat osm_lon road city state
That's good. Since that works, I'm guessing there may be an issue with the data frame that you pass to reverse_geocode (when you get NA results). You could print the values of the latitude and longitude columns to the screen and see if you spot anything.
If that doesn't reveal the problem then see if you can make a reproducible example with the reprex package:
Oh yes. I already asked in stackoverflow. https://stackoverflow.com/questions/73255542/unknown-issue-prevents-geocode-reverse-from-working. So far haven't heard an acceptable answer yet.
I tried the example from https://cran.r-project.org/web/packages/tidygeocoder/readme/README.html. But the address_found returned NA.
The data was: 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
The code was: reverse <- lat_longs %>% reverse_geocode(lat = latitude, long = longitude, method = 'osm', address = address_found, full_results = TRUE)