Geocoding reruns error after writing to the cache
- Dominant language
- R
- Stars
- 778
- Forks
- 234
- PR merge metrics
- No merged PRs in 30d
Description
I think this should not give an error. Thanks for the useful package.
``` r
ggmap::geocode("bern, Switzerland")
#> Source : https://maps.googleapis.com/maps/api/geocode/json?address=bern,+Switzerland&key=xxx-gHK2yiLHpsTi0WyX3USVv0ZzfY
#> # A tibble: 1 x 2
#> lon lat
#>
#> 1 7.45 46.9
ggmap::write_geocode_cache(fs::path(tempdir(), "s1.Rds"))
ggmap::geocode("bern, Switzerland")
#> Error in if (!override && (queries_used_in_last_second + queries_sought > : missing value where TRUE/FALSE needed
```
Created on 2020-10-03 by the [reprex package](https://reprex.tidyverse.org) (v0.3.0)
I should say that I have a google key in my `.Renviron` file via `ggmap::register_google(..., write = TRUE)`. It seems that `google_second_limit()` returns `NULL` so the above comparison can't be made. It boils down to `getOption("ggmap")$google$second_limit` being unset because second limit is not set in my `.Renviron`. I now put this in my Rprofile and it works:
```r
ggmap::register_google(
"xxx",
second_limit = 1,
day_limit = 500,
write = FALSE
)
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.