Skip to content

Commit

Permalink
Merge pull request #131
Browse files Browse the repository at this point in the history
  • Loading branch information
dpprdan authored Feb 20, 2021
2 parents 4c0a4ee + 7d15741 commit 7b80608
Show file tree
Hide file tree
Showing 11 changed files with 63 additions and 89 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: opencage
Title: Geocode with the OpenCage API
Version: 0.2.1.9000
Version: 0.2.2
Authors@R: c(
person("Daniel", "Possenriede", email = "[email protected]", role = c("aut", "cre"), comment = c(ORCID = "0000-0002-6738-9845")),
person("Jesse", "Sadler", role = "aut", comment = c(ORCID = "0000-0001-6081-9681")),
Expand Down
4 changes: 3 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# opencage (development version)
# opencage 0.2.2

* Fixed a test that caused an error on CRAN's Solaris (#131).

# opencage 0.2.1

Expand Down
12 changes: 6 additions & 6 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ output:

<!-- badges: end -->

Geocode with the [OpenCage](https://opencagedata.com/) API, either from place name to longitude and latitude (forward geocoding) or from longitude and latitude to the name and address of the location (reverse geocoding).
Geocode with the [OpenCage](https://opencagedata.com) API, either from place name to longitude and latitude (forward geocoding) or from longitude and latitude to the name and address of the location (reverse geocoding).

## Installation

Expand All @@ -27,7 +27,7 @@ Install the package with:
install.packages("opencage")
```

Or install the development version using [remotes](https://remotes.r-lib.org/) with:
Or install the development version using [remotes](https://remotes.r-lib.org) with:

```{r, eval = FALSE}
remotes::install_github("ropensci/opencage")
Expand Down Expand Up @@ -64,14 +64,14 @@ But remember, the vignettes are really great! We have:

## About OpenCage

The [OpenCage](https://opencagedata.com/) API supports forward and reverse geocoding.
The [OpenCage](https://opencagedata.com) API supports forward and reverse geocoding.
Sources of OpenCage are open geospatial data including
[OpenStreetMap](https://www.openstreetmap.org/),
[OpenStreetMap](https://www.openstreetmap.org),
[DataScienceToolkit](https://github.com/petewarden/dstk),
[GeoPlanet](https://en.wikipedia.org/wiki/GeoPlanet),
[Natural Earth Data](https://www.naturalearthdata.com/),
[Natural Earth Data](https://www.naturalearthdata.com),
[libpostal](https://github.com/openvenues/libpostal),
[GeoNames](https://www.geonames.org/), and
[GeoNames](https://www.geonames.org), and
[Flickr's shapefiles](https://code.flickr.net/2009/05/21/flickr-shapefiles-public-dataset-10/) plus a whole lot more besides.
Refer to the current full [list of credits](https://opencagedata.com/credits).

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Peer-Review](https://badges.ropensci.org/36_status.svg)](https://github.com/rope

<!-- badges: end -->

Geocode with the [OpenCage](https://opencagedata.com/) API, either from
Geocode with the [OpenCage](https://opencagedata.com) API, either from
place name to longitude and latitude (forward geocoding) or from
longitude and latitude to the name and address of the location (reverse
geocoding).
Expand All @@ -33,7 +33,7 @@ install.packages("opencage")
```

Or install the development version using
[remotes](https://remotes.r-lib.org/) with:
[remotes](https://remotes.r-lib.org) with:

``` r
remotes::install_github("ropensci/opencage")
Expand Down Expand Up @@ -86,14 +86,14 @@ But remember, the vignettes are really great! We have:

## About OpenCage

The [OpenCage](https://opencagedata.com/) API supports forward and
The [OpenCage](https://opencagedata.com) API supports forward and
reverse geocoding. Sources of OpenCage are open geospatial data
including [OpenStreetMap](https://www.openstreetmap.org/),
including [OpenStreetMap](https://www.openstreetmap.org),
[DataScienceToolkit](https://github.com/petewarden/dstk),
[GeoPlanet](https://en.wikipedia.org/wiki/GeoPlanet), [Natural Earth
Data](https://www.naturalearthdata.com/),
Data](https://www.naturalearthdata.com),
[libpostal](https://github.com/openvenues/libpostal),
[GeoNames](https://www.geonames.org/), and [Flickr’s
[GeoNames](https://www.geonames.org), and [Flickr’s
shapefiles](https://code.flickr.net/2009/05/21/flickr-shapefiles-public-dataset-10/)
plus a whole lot more besides. Refer to the current full [list of
credits](https://opencagedata.com/credits).
Expand Down
21 changes: 6 additions & 15 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
## Release summary

### v0.2.1
* Fixed two URLs, one of which was rejected on the v0.2.0 submission.

### v0.2.0 (unreleased)
* Rewrite of the package, see NEWS.md for details.
* Change of maintainer:
* New Maintainer: Daniel Possenriede <[email protected]>
* Old maintainer: Maëlle Salmon <[email protected]>
### v0.2.2
This patch version fixes a test that caused an error on CRAN's Solaris (<https://github.com/ropensci/opencage/pull/131>, <https://www.r-project.org/nosvn/R.check/r-patched-solaris-x86/opencage-00check.html>).

## Test environments
* local x86_64-w64-mingw32/x64 install, R 4.0.3
* local x86_64-w64-mingw32/x64, R 4.0.4
* GitHub Actions <https://github.com/ropensci/opencage/actions?query=workflow%3AR-CMD-check>:
* Ubuntu 20.04, R devel, release and oldrel
* windows-latest, R release
Expand All @@ -21,17 +15,14 @@
* Windows Server 2008 R2 SP1, R-devel, 32/64 bit
* win-builder (devel)

## R CMD check results
## R CMD check results (local)

Duration: 2m 1.9s
Duration: 2m 10.8s

> checking CRAN incoming feasibility ... NOTE
Maintainer: 'Daniel Possenriede <[email protected]>'
New maintainer:
Daniel Possenriede <[email protected]>
Old maintainer(s):
Maëlle Salmon <[email protected]>
Days since last update: 4

0 errors √ | 0 warnings √ | 1 note x

Expand Down
40 changes: 18 additions & 22 deletions revdep/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,27 @@

|field |value |
|:--------|:----------------------------|
|version |R version 4.0.3 (2020-10-10) |
|version |R version 4.0.4 (2021-02-15) |
|os |Windows 10 x64 |
|system |x86_64, mingw32 |
|ui |RStudio |
|language |en |
|collate |German_Germany.1252 |
|ctype |German_Germany.1252 |
|tz |Europe/Berlin |
|date |2021-02-11 |
|date |2021-02-18 |

# Dependencies

|package |old |new |<U+0394> |
|:-----------|:------|:------|:--|
|opencage |0.1.4 |0.2.0 |* |
|askpass |1.1 |NA |* |
|opencage |0.2.1 |0.2.2 |* |
|assertthat |0.2.1 |0.2.1 | |
|cachem |1.0.3 |1.0.3 | |
|cachem |1.0.4 |1.0.4 | |
|cli |2.3.0 |2.3.0 | |
|cpp11 |NA |0.2.6 |* |
|cpp11 |0.2.6 |0.2.6 | |
|crayon |1.4.1 |1.4.1 | |
|crul |NA |1.0.0 |* |
|crul |1.1.0 |1.1.0 | |
|curl |4.3 |4.3 | |
|digest |0.6.27 |0.6.27 | |
|dplyr |1.0.4 |1.0.4 | |
Expand All @@ -32,33 +31,30 @@
|fastmap |1.1.0 |1.1.0 | |
|generics |0.1.0 |0.1.0 | |
|glue |1.4.2 |1.4.2 | |
|hms |NA |1.0.0 |* |
|httpcode |NA |0.3.0 |* |
|httr |1.4.2 |NA |* |
|hms |1.0.0 |1.0.0 | |
|httpcode |0.3.0 |0.3.0 | |
|jsonlite |1.7.2 |1.7.2 | |
|lifecycle |0.2.0 |0.2.0 | |
|lifecycle |1.0.0 |1.0.0 | |
|magrittr |2.0.1 |2.0.1 | |
|memoise |2.0.0 |2.0.0 | |
|mime |0.9 |0.9 | |
|openssl |1.4.3 |NA |* |
|mime |0.10 |0.10 | |
|pillar |1.4.7 |1.4.7 | |
|pkgconfig |2.0.3 |2.0.3 | |
|prettyunits |NA |1.1.1 |* |
|progress |NA |1.2.2 |* |
|prettyunits |1.1.1 |1.1.1 | |
|progress |1.2.2 |1.2.2 | |
|purrr |0.3.4 |0.3.4 | |
|R6 |2.5.0 |2.5.0 | |
|ratelimitr |NA |0.4.1 |* |
|Rcpp |NA |1.0.6 |* |
|ratelimitr |0.4.1 |0.4.1 | |
|Rcpp |1.0.6 |1.0.6 | |
|rlang |0.4.10 |0.4.10 | |
|sys |3.4 |NA |* |
|tibble |3.0.6 |3.0.6 | |
|tidyr |NA |1.1.2 |* |
|tidyr |1.1.2 |1.1.2 | |
|tidyselect |1.1.0 |1.1.0 | |
|triebeard |NA |0.3.0 |* |
|urltools |NA |1.7.3 |* |
|triebeard |0.3.0 |0.3.0 | |
|urltools |1.7.3 |1.7.3 | |
|utf8 |1.1.4 |1.1.4 | |
|vctrs |0.3.6 |0.3.6 | |
|withr |NA |2.4.1 |* |
|withr |2.4.1 |2.4.1 | |

# Revdeps

27 changes: 6 additions & 21 deletions tests/testthat/test-oc_config.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,35 +53,22 @@ test_that("oc_config throws error with faulty OpenCage key", {

# test rate_sec argument --------------------------------------------------

timer <- function(expr) {
system.time(expr)[["elapsed"]]
}

oc_get_limited_test <- function(reps) {
replicate(
reps,
oc_get_limited("https://httpbin.org/get")
)
}

test_that("oc_config updates rate limit of oc_get_limit", {
skip_if_offline("httpbin.org")
# make sure there is a key present
withr::local_envvar(c("OPENCAGE_KEY" = key_200))

rps <- 5L
oc_config(rate_sec = rps)
t <- timer(oc_get_limited_test(rps + 1))
expect_gt(t, 1)
expect_lt(t, 3)
expect_equal(ratelimitr::get_rates(oc_get_limited)[[1]][["n"]], rps)

rps <- 3L
oc_config(rate_sec = rps)
t <- timer(oc_get_limited_test(rps + 1))
expect_gt(t, 1)
expect_lt(t, 3)
})
expect_equal(ratelimitr::get_rates(oc_get_limited)[[1]][["n"]], rps)

# set rate_sec back to default: 1L/sec
oc_config()
expect_equal(ratelimitr::get_rates(oc_get_limited)[[1]][["n"]], 1L)
})

# test no_record argument -------------------------------------------------

Expand Down Expand Up @@ -111,7 +98,6 @@ test_that("oc_config sets no_record option", {
expect_equal(getOption("oc_no_record"), TRUE)
res <- oc_process("Hamburg", return = "url_only")
expect_match(res[[1]], "&no_record=1", fixed = TRUE)

})

# test show_key argument --------------------------------------------------
Expand All @@ -128,5 +114,4 @@ test_that("oc_config sets show_key option", {
withr::local_envvar(c("OPENCAGE_KEY" = key_200))
oc_config(show_key = TRUE)
expect_equal(getOption("oc_show_key"), TRUE)

})
2 changes: 1 addition & 1 deletion vignettes/customise_query.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Customise your query"
subtitle: "Get more and better results from OpenCage"
author: "Daniel Possenriede, Jesse Sadler, Maëlle Salmon"
date: "2021-02-11"
date: "2021-02-18"
description: >
"The OpenCage API supports about a dozen parameters to customise a query and here we will explain how to use them."
output:
Expand Down
16 changes: 8 additions & 8 deletions vignettes/opencage.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Introduction to opencage"
subtitle: "Forward and Reverse Geocoding"
author: "Daniel Possenriede, Jesse Sadler, Maëlle Salmon"
date: "2021-02-14"
date: "2021-02-18"
description: >
"Get started with the opencage R package to geocode with the OpenCage API, either from place name to longitude and latitude (forward geocoding) or from longitude and latitude to the name and address of a location (reverse geocoding)."
output:
Expand Down Expand Up @@ -46,7 +46,7 @@ There are three safer ways to set your API key instead:
From there it will be fetched by all functions that call the OpenCage API.
You do not even have to call `oc_config()` to set your key;
you can start geocoding right away.
If you have the {[usethis](https://usethis.r-lib.org/)} package installed, you can edit your `.Renviron` with `usethis::edit_r_environ()`.
If you have the {[usethis](https://usethis.r-lib.org)} package installed, you can edit your `.Renviron` with `usethis::edit_r_environ()`.
We strongly recommend storing your API key in the user-level `.Renviron`, as opposed to the project-level.
This makes it less likely you will share sensitive information by mistake.

Expand All @@ -66,7 +66,7 @@ If you have a "Free Trial" account with OpenCage, you can skip to the next secti

If you have a paid account, you can set the rate limit for the active R session with `oc_config(rate_sec = n)` where `n` is the appropriate rate limit.
You can set the rate limit persistently across sessions by setting an `oc_rate_sec` option in your `.Rprofile`.
If you have the {[usethis](https://usethis.r-lib.org/)} package installed, you can edit your `.Rprofile` with `usethis::edit_r_profile()`.
If you have the {[usethis](https://usethis.r-lib.org)} package installed, you can edit your `.Rprofile` with `usethis::edit_r_profile()`.

### Privacy

Expand Down Expand Up @@ -128,7 +128,7 @@ oc_forward_df(placename = opera)
#> placename oc_lat oc_lng oc_formatted
#> <chr> <dbl> <dbl> <chr>
#> 1 Palacio de Bellas Artes 19.4 -99.1 Palacio de Bellas Artes, Avenida Juárez, Centro Urbano, 06050 Mexico City, Mexico
#> 2 Scala 45.5 9.19 Teatro alla Scala, Via Giuseppe Verdi, 20121 Milan Milan, Italy
#> 2 Scala 45.5 9.19 Teatro alla Scala, Largo Antonio Ghiringhelli, Milan Milan, Italy
#> 3 Sydney Opera House -33.9 151. Sydney Opera House, 2 Macquarie Street, Sydney NSW 2000, Australia
```

Expand Down Expand Up @@ -216,11 +216,11 @@ To minimize the number of requests sent to the API {opencage} uses {[memoise](ht
```r
system.time(oc_reverse(latitude = 10, longitude = 10))
#> user system elapsed
#> 0.00 0.00 0.81
#> 0.03 0.00 0.92

system.time(oc_reverse(latitude = 10, longitude = 10))
#> user system elapsed
#> 0 0 0
#> 0.01 0.00 0.02
```

To clear the cache of all results either start a new R session or call `oc_clear_cache()`.
Expand All @@ -232,7 +232,7 @@ oc_clear_cache()

system.time(oc_reverse(latitude = 10, longitude = 10))
#> user system elapsed
#> 0.03 0.00 0.74
#> 0.00 0.00 0.92
```

As you probably know, cache invalidation is one of the harder things to do in computer science.
Expand All @@ -249,4 +249,4 @@ Besides `oc_forward_df()` and `oc_reverse_df()`, which always return a single ti
Depending on what you specify as the `return` parameter, `oc_forward()` and `oc_reverse()` will return either a list of tibbles (`df_list`, the default), JSON lists (`json_list`), GeoJSON lists (`geojson_list`), or the URL with which the API would be called (`url_only`).
Learn more in the ["Output options"](output_options.html) vignette.

Please report any issues or bugs on [our GitHub repository](https://github.com/ropensci/opencage/issues) and post questions on [discuss.ropensci.org](https://discuss.ropensci.org/).
Please report any issues or bugs on [our GitHub repository](https://github.com/ropensci/opencage/issues) and post questions on [discuss.ropensci.org](https://discuss.ropensci.org).
6 changes: 3 additions & 3 deletions vignettes/opencage.Rmd.src
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ There are three safer ways to set your API key instead:
From there it will be fetched by all functions that call the OpenCage API.
You do not even have to call `oc_config()` to set your key;
you can start geocoding right away.
If you have the {[usethis](https://usethis.r-lib.org/)} package installed, you can edit your `.Renviron` with `usethis::edit_r_environ()`.
If you have the {[usethis](https://usethis.r-lib.org)} package installed, you can edit your `.Renviron` with `usethis::edit_r_environ()`.
We strongly recommend storing your API key in the user-level `.Renviron`, as opposed to the project-level.
This makes it less likely you will share sensitive information by mistake.

Expand All @@ -74,7 +74,7 @@ If you have a "Free Trial" account with OpenCage, you can skip to the next secti

If you have a paid account, you can set the rate limit for the active R session with `oc_config(rate_sec = n)` where `n` is the appropriate rate limit.
You can set the rate limit persistently across sessions by setting an `oc_rate_sec` option in your `.Rprofile`.
If you have the {[usethis](https://usethis.r-lib.org/)} package installed, you can edit your `.Rprofile` with `usethis::edit_r_profile()`.
If you have the {[usethis](https://usethis.r-lib.org)} package installed, you can edit your `.Rprofile` with `usethis::edit_r_profile()`.

### Privacy

Expand Down Expand Up @@ -210,4 +210,4 @@ Besides `oc_forward_df()` and `oc_reverse_df()`, which always return a single ti
Depending on what you specify as the `return` parameter, `oc_forward()` and `oc_reverse()` will return either a list of tibbles (`df_list`, the default), JSON lists (`json_list`), GeoJSON lists (`geojson_list`), or the URL with which the API would be called (`url_only`).
Learn more in the ["Output options"](output_options.html) vignette.

Please report any issues or bugs on [our GitHub repository](https://github.com/ropensci/opencage/issues) and post questions on [discuss.ropensci.org](https://discuss.ropensci.org/).
Please report any issues or bugs on [our GitHub repository](https://github.com/ropensci/opencage/issues) and post questions on [discuss.ropensci.org](https://discuss.ropensci.org).
Loading

0 comments on commit 7b80608

Please sign in to comment.