diff --git a/NEWS.md b/NEWS.md index 798aca8d..e16b9721 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,8 @@ # tidygeocoder (development version) - Corrected documentation for `quiet` parameter in `geo()` and `reverse_geo()` +- Reconfigured the vignette so that it is precomputed and is not executed during +`R CMD check` (ie. `devtools::check()`). Also added a check at the beginning of the vignette to check for the availability of APIs. This fixes an issue that occurred on Mac CRAN checks ([#152](https://github.com/jessecambon/tidygeocoder/issues/152)). # tidygeocoder 1.0.4 diff --git a/R/geo.R b/R/geo.R index c84c671f..1dc1eb1b 100644 --- a/R/geo.R +++ b/R/geo.R @@ -71,19 +71,19 @@ progress_geo <- function(pb = NULL, ...) { #' #' @param min_time minimum amount of time for a query to take (in seconds). If NULL #' then min_time will be set to the default value specified in [min_time_reference]. -#' @param progress_bar if TRUE then a progress bar will be displayed to track query -#' progress for single input geocoding (1 input per query). By default the progress bar +#' @param progress_bar if TRUE then a progress bar will be displayed +#' for single input geocoding (1 input per query). By default the progress bar #' will not be shown for code executed when knitting R Markdown files or code within #' an RStudio notebook chunk. Can be set permanently with `options(tidygeocoder.progress_bar = FALSE)`. #' @param quiet if TRUE then console messages that are displayed by default -#' regarding queries will be suppressed. Can be set permanently with `options(tidygeocoder.quiet = TRUE)`. +#' regarding queries will be suppressed. FALSE is default. +#' Can be set permanently with `options(tidygeocoder.quiet = TRUE)`. #' @param api_url custom API URL. If specified, the default API URL will be overridden. #' This parameter can be used to specify a local Nominatim server, for instance. #' @param timeout query timeout (in minutes) #' #' @param flatten if TRUE (default) then any nested dataframes in results are flattened if possible. -#' Note that in some cases results are flattened regardless such as for -#' Geocodio batch geocoding. +#' Note that in some cases results are flattened regardless such as for Geocodio batch geocoding. #' @param batch_limit `r get_batch_limit_documentation(reverse = FALSE)` #' @param batch_limit_error `r lifecycle::badge("deprecated")` `r get_batch_limit_error_documentation(reverse = FALSE)` #' @param verbose if TRUE then detailed logs are output to the console. FALSE is default. Can be set diff --git a/docs/articles/developer_notes.html b/docs/articles/developer_notes.html index 362484ec..fadad31a 100644 --- a/docs/articles/developer_notes.html +++ b/docs/articles/developer_notes.html @@ -162,7 +162,7 @@

#> limit : "1" #> format : "json" #> HTTP Status Code: 200 -#> Query completed in: 0.3 seconds +#> Query completed in: 0.4 seconds #> Total query time (including sleep): 1 seconds #> #> @@ -302,7 +302,13 @@

  • external/create_logo.Rmd +
  • +
  • +vignettes/tidygeocoder.Rmd.orig +
  • @@ -311,9 +317,9 @@

    Testing

    diff --git a/docs/articles/tidygeocoder.html b/docs/articles/tidygeocoder.html index 8f313696..1082a64c 100644 --- a/docs/articles/tidygeocoder.html +++ b/docs/articles/tidygeocoder.html @@ -197,7 +197,7 @@

    lat = latitude, long = longitude ) #> Passing 2 addresses to the Nominatim single address geocoder -#> Query completed in: 2.1 seconds +#> Query completed in: 2 seconds @@ -222,7 +222,7 @@

    census_c1 <- address_components %>% geocode(street = street, city = cty, state = st, method = "census") #> Passing 2 addresses to the US Census batch geocoder -#> Query completed in: 1.8 seconds +#> Query completed in: 1.4 seconds

    address
    @@ -255,7 +255,7 @@

    method = "census", full_results = TRUE, api_options = list(census_return_type = 'geographies') ) #> Passing 2 addresses to the US Census batch geocoder -#> Query completed in: 1.2 seconds +#> Query completed in: 1.5 seconds

    street
    @@ -393,7 +393,7 @@

    rev1 <- lat_longs1 %>% reverse_geocode(lat = latitude, long = longitude, address = addr, method = "osm") #> Passing 2 coordinates to the Nominatim single coordinate geocoder -#> Query completed in: 2.1 seconds +#> Query completed in: 2 seconds

    @@ -433,9 +433,9 @@

    #> Columns: 22 #> $ lat <dbl> 38.89587, 43.65348 #> $ long <dbl> -77.03077, -79.38393 -#> $ address <chr> "L’Enfant's plan, Pennsylvania Avenue, Washington, District of Columbia, 20045, United S… +#> $ address <chr> "L’Enfant's plan, Pennsylvania Avenue, Washington, District of Columbia, 20045, United States", "Toronto City Hall, 100, Queen Str… #> $ place_id <int> 301711857, 137497520 -#> $ licence <chr> "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright", "Data © OpenSt… +#> $ licence <chr> "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright", "Data © OpenStreetMap contributors, ODbL 1.0. https://os… #> $ osm_type <chr> "way", "way" #> $ osm_id <int> 899927546, 198500761 #> $ osm_lat <chr> "38.895859599999994", "43.6536032" @@ -447,7 +447,7 @@

    #> $ postcode <chr> "20045", "M5H 2N2" #> $ country <chr> "United States", "Canada" #> $ country_code <chr> "us", "ca" -#> $ boundingbox <list> <"38.8957273", "38.8959688", "-77.0311667", "-77.0301895">, <"43.6529946", "43.6541458",… +#> $ boundingbox <list> <"38.8957273", "38.8959688", "-77.0311667", "-77.0301895">, <"43.6529946", "43.6541458", "-79.3848438", "-79.3830415"> #> $ amenity <chr> NA, "Toronto City Hall" #> $ house_number <chr> NA, "100" #> $ neighbourhood <chr> NA, "Financial District" @@ -583,7 +583,7 @@

    ) #> #> Passing 3 addresses to the US Census batch geocoder -#> Query completed in: 0.1 seconds +#> Query completed in: 0.2 seconds #> Passing 2 addresses to the Nominatim single address geocoder #> Query completed in: 2 seconds

    @@ -697,15 +697,15 @@

    #> $ lat <dbl> -12.06211, -12.20011, -11.99997, 30.03521, 30.04439, 30.03325 #> $ long <dbl> -77.03653, -76.28506, -76.83322, 31.56337, 31.23573, 31.56216 #> $ place_id <int> 258244064, 258655931, 258306819, 258758158, 793757, 298971141 -#> $ licence <chr> "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright", "Data © OpenStre… +#> $ licence <chr> "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright", "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.… #> $ osm_type <chr> "relation", "relation", "relation", "relation", "node", "relation" #> $ osm_id <int> 1944756, 1944659, 1944670, 5466227, 271613766, 4103336 -#> $ boundingbox <list> <"-12.0797663", "-12.0303496", "-77.0884555", "-77.0017774">, <"-13.3235137", "-10.2741856… -#> $ display_name <chr> "Lima, Lima Metropolitana, Lima, Perú", "Lima, Perú", "Lima, Lima Metropolitana, Lima, Per… +#> $ boundingbox <list> <"-12.0797663", "-12.0303496", "-77.0884555", "-77.0017774">, <"-13.3235137", "-10.2741856", "-77.8863105", "-75.5075">, <"-12.51993… +#> $ display_name <chr> "Lima, Lima Metropolitana, Lima, Perú", "Lima, Perú", "Lima, Lima Metropolitana, Lima, Perú", "القاهرة, محافظة القاهرة, مصر", "القاه… #> $ class <chr> "boundary", "boundary", "boundary", "place", "place", "boundary" #> $ type <chr> "administrative", "administrative", "administrative", "city", "city", "administrative" #> $ importance <dbl> 0.7830015, 0.6119761, 0.5934835, 0.6960286, 0.6960286, 0.4835559 -#> $ icon <chr> "https://nominatim.openstreetmap.org/ui/mapicons//poi_boundary_administrative.p.20.png", "… +#> $ icon <chr> "https://nominatim.openstreetmap.org/ui/mapicons//poi_boundary_administrative.p.20.png", "https://nominatim.openstreetmap.org/ui/map…

    To directly specify specific API parameters for a given method you can use the custom_query parameter. For example, the Nominatim (OSM) geocoder has a ‘polygon_geojson’ argument that can be used to return GeoJSON geometry content. To pass this parameter you can insert it with a named list using the custom_query argument:

     cairo_geo <- geo("Cairo, Egypt",
    @@ -724,7 +724,7 @@ 

    #> polygon_geojson : "1" #> format : "json" #> HTTP Status Code: 200 -#> Query completed in: 0.2 seconds +#> Query completed in: 0.1 seconds #> Total query time (including sleep): 1 seconds #> #> Query completed in: 1 seconds diff --git a/docs/news/index.html b/docs/news/index.html index 55fa30f9..c8e4c876 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -181,6 +181,7 @@

    • Corrected documentation for quiet parameter in geo() and reverse_geo()
    • +
    • Reconfigured the vignette so that it is precomputed and is not executed during R CMD check (ie. devtools::check()). Also added a check at the beginning of the vignette to check for the availability of APIs. This fixes an issue that occurred on Mac CRAN checks (#152).

    diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index f979d890..fdf0fff2 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -5,7 +5,7 @@ articles: developer_notes: developer_notes.html geocoder_services: geocoder_services.html tidygeocoder: tidygeocoder.html -last_built: 2021-10-24T13:36Z +last_built: 2021-10-24T18:49Z urls: reference: https://jessecambon.github.io/tidygeocoder/reference article: https://jessecambon.github.io/tidygeocoder/articles diff --git a/docs/reference/geo.html b/docs/reference/geo.html index ff671cad..cb6563da 100644 --- a/docs/reference/geo.html +++ b/docs/reference/geo.html @@ -349,15 +349,16 @@

    Arg

    - +regarding queries will be suppressed. FALSE is default. +Can be set permanently with options(tidygeocoder.quiet = TRUE).

    @@ -371,8 +372,7 @@

    Arg

    +Note that in some cases results are flattened regardless such as for Geocodio batch geocoding.

    @@ -468,7 +468,7 @@

    Examp
    # \donttest{ geo(street = "600 Peachtree Street NE", city = "Atlanta", state = "Georgia", method = "census") -
    #> Passing 1 address to the US Census single address geocoder
    #> Query completed in: 4.4 seconds
    #> # A tibble: 1 × 5 +
    #> Passing 1 address to the US Census single address geocoder
    #> Query completed in: 5.6 seconds
    #> # A tibble: 1 × 5 #> street city state lat long #> <chr> <chr> <chr> <dbl> <dbl> #> 1 600 Peachtree Street NE Atlanta Georgia 33.8 -84.4
    @@ -482,7 +482,7 @@

    Examp #> 3 Nairobi, Kenya -1.30 36.8

    geo("100 Main St New York, NY", full_results = TRUE, method = "census", api_options = list(census_return_type = 'geographies')) -
    #> Passing 1 address to the US Census single address geocoder
    #> Query completed in: 1.5 seconds
    #> # A tibble: 1 × 28 +
    #> Passing 1 address to the US Census single address geocoder
    #> Query completed in: 1.8 seconds
    #> # A tibble: 1 × 28 #> address lat long matchedAddress tigerLine.tiger… tigerLine.side #> <chr> <dbl> <dbl> <chr> <chr> <chr> #> 1 100 Main St New York, NY 40.7 -74.0 100 MAIN ST, … 59662602 R diff --git a/docs/reference/geo_combine.html b/docs/reference/geo_combine.html index 50a5817e..72f798f0 100644 --- a/docs/reference/geo_combine.html +++ b/docs/reference/geo_combine.html @@ -282,7 +282,7 @@

    Examp address = example_addresses, global_params = list(address = 'address') ) -

    #>
    #>
    #> Passing 3 addresses to the US Census batch geocoder
    #> Query completed in: 0.3 seconds
    #> Passing 2 addresses to the Nominatim single address geocoder
    #> Query completed in: 2 seconds
    #> # A tibble: 3 × 4 +
    #>
    #>
    #> Passing 3 addresses to the US Census batch geocoder
    #> Query completed in: 0.2 seconds
    #> Passing 2 addresses to the Nominatim single address geocoder
    #> Query completed in: 2 seconds
    #> # A tibble: 3 × 4 #> address lat long query #> <chr> <dbl> <dbl> <chr> #> 1 100 Main St New York, NY 40.7 -74.0 "census" @@ -299,7 +299,7 @@

    Examp cascade = FALSE, return_list = TRUE ) -

    #>
    #>
    #>
    #> Passing 3 addresses to the ArcGIS single address geocoder
    #> Query completed in: 1.2 seconds
    #> Passing 3 addresses to the US Census single address geocoder
    #> Query completed in: 1 seconds
    #> Passing 3 addresses to the US Census batch geocoder
    #> Query completed in: 0.2 seconds
    #> $arcgis +
    #>
    #>
    #>
    #> Passing 3 addresses to the ArcGIS single address geocoder
    #> Query completed in: 2.5 seconds
    #> Passing 3 addresses to the US Census single address geocoder
    #> Query completed in: 1.5 seconds
    #> Passing 3 addresses to the US Census batch geocoder
    #> Query completed in: 0.3 seconds
    #> $arcgis #> # A tibble: 3 × 3 #> address lat long #> <chr> <dbl> <dbl> @@ -332,7 +332,7 @@

    Examp country = c('Japan', 'United States'), cascade = FALSE ) -

    #>
    #>
    #> Passing 2 addresses to the ArcGIS single address geocoder
    #> Query completed in: 0.2 seconds
    #> Passing 2 addresses to the Nominatim single address geocoder
    #> Query completed in: 2 seconds
    #> # A tibble: 4 × 5 +
    #>
    #>
    #> Passing 2 addresses to the ArcGIS single address geocoder
    #> Query completed in: 1.2 seconds
    #> Passing 2 addresses to the Nominatim single address geocoder
    #> Query completed in: 2 seconds
    #> # A tibble: 4 × 5 #> city country lat long query #> <chr> <chr> <dbl> <dbl> <chr> #> 1 Tokyo Japan 35.7 140. arcgis diff --git a/docs/reference/geocode.html b/docs/reference/geocode.html index 3ea6c8be..8766d13a 100644 --- a/docs/reference/geocode.html +++ b/docs/reference/geocode.html @@ -302,7 +302,7 @@

    Examp library(dplyr, warn.conflicts = FALSE) sample_addresses %>% slice(1:2) %>% geocode(addr, method = 'arcgis') -

    #> Passing 2 addresses to the ArcGIS single address geocoder
    #> Query completed in: 1.1 seconds
    #> # A tibble: 2 × 4 +
    #> Passing 2 addresses to the ArcGIS single address geocoder
    #> Query completed in: 0.2 seconds
    #> # A tibble: 2 × 4 #> name addr lat long #> <chr> <chr> <dbl> <dbl> #> 1 White House 1600 Pennsylvania Ave NW Washington, DC 38.9 -77.0 diff --git a/docs/reference/geocode_combine.html b/docs/reference/geocode_combine.html index 45b296ce..90d03d9b 100644 --- a/docs/reference/geocode_combine.html +++ b/docs/reference/geocode_combine.html @@ -269,7 +269,7 @@

    Examp geocode_combine( queries = list(list(method = 'census'), list(method = 'osm')), global_params = list(address = 'addr'), cascade = TRUE) -

    #>
    #>
    #> Passing 9 addresses to the US Census batch geocoder
    #> Query completed in: 1.1 seconds
    #> Passing 5 addresses to the Nominatim single address geocoder
    #> Query completed in: 5 seconds
    #> # A tibble: 9 × 5 +
    #>
    #>
    #> Passing 9 addresses to the US Census batch geocoder
    #> Query completed in: 1.4 seconds
    #> Passing 5 addresses to the Nominatim single address geocoder
    #> Query completed in: 5 seconds
    #> # A tibble: 9 × 5 #> name addr lat long query #> <chr> <chr> <dbl> <dbl> <chr> #> 1 White House 1600 Pennsylvania Ave NW Washington, … 38.9 -77.0 cens… @@ -300,7 +300,7 @@

    Examp city = 'city', state = 'state', postalcode = 'zip_cd'), query_names = c('census batch', 'census single', 'osm') ) -

    #>
    #>
    #>
    #> Passing 4 addresses to the US Census batch geocoder
    #> Query completed in: 0.3 seconds
    #> Passing 3 addresses to the US Census single address geocoder
    #> Query completed in: 1.6 seconds
    #> Passing 1 address to the Nominatim single address geocoder
    #> Query completed in: 1 seconds
    #> # A tibble: 4 × 7 +
    #>
    #>
    #>
    #> Passing 4 addresses to the US Census batch geocoder
    #> Query completed in: 0.7 seconds
    #> Passing 3 addresses to the US Census single address geocoder
    #> Query completed in: 2.2 seconds
    #> Passing 1 address to the Nominatim single address geocoder
    #> Query completed in: 1 seconds
    #> # A tibble: 4 × 7 #> street_address city state zip_cd lat long query #> <chr> <chr> <chr> <dbl> <dbl> <dbl> <chr> #> 1 624 W DAVIS ST #1D BURLINGTON NC 27215 36.1 -79.4 census single @@ -317,7 +317,7 @@

    Examp cascade = FALSE, return_list = TRUE ) -

    #>
    #>
    #> Passing 4 addresses to the US Census batch geocoder
    #> Query completed in: 0.3 seconds
    #> Passing 4 addresses to the ArcGIS single address geocoder
    #> Query completed in: 1.2 seconds
    #> $census +
    #>
    #>
    #> Passing 4 addresses to the US Census batch geocoder
    #> Query completed in: 0.6 seconds
    #> Passing 4 addresses to the ArcGIS single address geocoder
    #> Query completed in: 1.4 seconds
    #> $census #> # A tibble: 4 × 6 #> street_address city state zip_cd lat long #> <chr> <chr> <chr> <dbl> <dbl> <dbl> diff --git a/docs/reference/reverse_geo.html b/docs/reference/reverse_geo.html index 8deb1b59..ab8a000c 100644 --- a/docs/reference/reverse_geo.html +++ b/docs/reference/reverse_geo.html @@ -298,15 +298,16 @@

    Arg

    - +regarding queries will be suppressed. FALSE is default. +Can be set permanently with options(tidygeocoder.quiet = TRUE).

    @@ -320,8 +321,7 @@

    Arg

    +Note that in some cases results are flattened regardless such as for Geocodio batch geocoding.

    diff --git a/docs/reference/reverse_geocode.html b/docs/reference/reverse_geocode.html index 254bd3d8..ccc3b661 100644 --- a/docs/reference/reverse_geocode.html +++ b/docs/reference/reverse_geocode.html @@ -285,7 +285,7 @@

    Examp louisville %>% head(3) %>% reverse_geocode(lat = latitude, long = longitude, method = 'arcgis') -
    #> Passing 3 coordinates to the ArcGIS single coordinate geocoder
    #> Query completed in: 2.3 seconds
    #> # A tibble: 3 × 7 +
    #> Passing 3 coordinates to the ArcGIS single coordinate geocoder
    #> Query completed in: 0.2 seconds
    #> # A tibble: 3 × 7 #> street city state zip latitude longitude address #> <chr> <chr> <chr> <dbl> <dbl> <dbl> <chr> #> 1 2722 ELLIOTT AVE Louisville Kentucky 40211 38.3 -85.8 2722 Elliott Av… diff --git a/man/geo.Rd b/man/geo.Rd index 7edfcc24..2f92675e 100644 --- a/man/geo.Rd +++ b/man/geo.Rd @@ -114,13 +114,14 @@ return_addresses to FALSE does not prevent this.} \item{min_time}{minimum amount of time for a query to take (in seconds). If NULL then min_time will be set to the default value specified in \link{min_time_reference}.} -\item{progress_bar}{if TRUE then a progress bar will be displayed to track query -progress for single input geocoding (1 input per query). By default the progress bar +\item{progress_bar}{if TRUE then a progress bar will be displayed +for single input geocoding (1 input per query). By default the progress bar will not be shown for code executed when knitting R Markdown files or code within an RStudio notebook chunk. Can be set permanently with \code{options(tidygeocoder.progress_bar = FALSE)}.} \item{quiet}{if TRUE then console messages that are displayed by default -regarding queries will be suppressed. Can be set permanently with \code{options(tidygeocoder.quiet = TRUE)}.} +regarding queries will be suppressed. FALSE is default. +Can be set permanently with \code{options(tidygeocoder.quiet = TRUE)}.} \item{api_url}{custom API URL. If specified, the default API URL will be overridden. This parameter can be used to specify a local Nominatim server, for instance.} @@ -128,8 +129,7 @@ This parameter can be used to specify a local Nominatim server, for instance.} \item{timeout}{query timeout (in minutes)} \item{flatten}{if TRUE (default) then any nested dataframes in results are flattened if possible. -Note that in some cases results are flattened regardless such as for -Geocodio batch geocoding.} +Note that in some cases results are flattened regardless such as for Geocodio batch geocoding.} \item{batch_limit}{limit to the number of addresses in a batch geocoding query. Defaults to the value in \link{batch_limit_reference} if not specified.} diff --git a/man/reverse_geo.Rd b/man/reverse_geo.Rd index bc6a1362..4b1c95fc 100644 --- a/man/reverse_geo.Rd +++ b/man/reverse_geo.Rd @@ -79,13 +79,14 @@ most services return the input coordinates with \code{full_results = TRUE} and s \item{min_time}{minimum amount of time for a query to take (in seconds). If NULL then min_time will be set to the default value specified in \link{min_time_reference}.} -\item{progress_bar}{if TRUE then a progress bar will be displayed to track query -progress for single input geocoding (1 input per query). By default the progress bar +\item{progress_bar}{if TRUE then a progress bar will be displayed +for single input geocoding (1 input per query). By default the progress bar will not be shown for code executed when knitting R Markdown files or code within an RStudio notebook chunk. Can be set permanently with \code{options(tidygeocoder.progress_bar = FALSE)}.} \item{quiet}{if TRUE then console messages that are displayed by default -regarding queries will be suppressed. Can be set permanently with \code{options(tidygeocoder.quiet = TRUE)}.} +regarding queries will be suppressed. FALSE is default. +Can be set permanently with \code{options(tidygeocoder.quiet = TRUE)}.} \item{api_url}{custom API URL. If specified, the default API URL will be overridden. This parameter can be used to specify a local Nominatim server, for instance.} @@ -93,8 +94,7 @@ This parameter can be used to specify a local Nominatim server, for instance.} \item{timeout}{query timeout (in minutes)} \item{flatten}{if TRUE (default) then any nested dataframes in results are flattened if possible. -Note that in some cases results are flattened regardless such as for -Geocodio batch geocoding.} +Note that in some cases results are flattened regardless such as for Geocodio batch geocoding.} \item{batch_limit}{limit to the number of coordinates in a batch geocoding query. Defaults to the value in \link{batch_limit_reference} if not specified.} diff --git a/vignettes/developer_notes.Rmd b/vignettes/developer_notes.Rmd index 1684b102..852a6d0b 100644 --- a/vignettes/developer_notes.Rmd +++ b/vignettes/developer_notes.Rmd @@ -92,6 +92,7 @@ This section documents how to add support for a new geocoding service to the pac These files don't necessarily need to be updated. However, you might need to make changes to these files if the service you are implementing requires some non-standard workarounds. + * **[R/query_factory.R](https://github.com/jessecambon/tidygeocoder/blob/main/R/query_factory.R)** * Houses the functions used to create and execute API queries. * **[R/documentation.R](https://github.com/jessecambon/tidygeocoder/blob/main/R/documentation.R)** @@ -103,12 +104,14 @@ These files don't necessarily need to be updated. However, you might need to mak * **[R/input_handling.R](https://github.com/jessecambon/tidygeocoder/blob/main/R/input_handling.R)** * Handles the deduplication of input data. * **[external/create_logo.Rmd](https://github.com/jessecambon/tidygeocoder/blob/main/external/create_logo.Rmd)** - * Create the package logo. + * Creates the package logo. +* **[vignettes/tidygeocoder.Rmd.orig](vignettes/tidygeocoder.Rmd.orig)** + * This file produces the vignette. See the knit command and comments at the top of this file. ### Testing -* Test out the new service with `verbose = TRUE` to make sure it behaves as expected. You can reference tests available [the 'sandbox' folder](https://github.com/jessecambon/tidygeocoder/tree/main/sandbox) for reference. -* Run `devtools::check()` to make sure the package still passes all tests and the vignette runs properly. To only run the package tests use `devtools::test()`, but note these tests do not query the geocoding services to avoid external dependencies. -* Run **[external/online_tests.R](https://github.com/jessecambon/tidygeocoder/blob/main/external/online_tests.R)** to test making queries to the geocoding services. These tests are not included in the internal package tests (`devtools::test()`) because they require API keys which would not exist on all systems and are dependent on the geocoding services being online at that the time of the test. -* Run the commands detailed in **[cran-comments.md](https://github.com/jessecambon/tidygeocoder/blob/main/cran-comments.md)** to test the package on other environments. Note that these tests should also be included in the automated GitHub actions tests for pull requests. -* When prepping for a release, use `urlchecker::url_check()` to check all package URLs. \ No newline at end of file +- Test out the new service to make sure it behaves as expected. You can reference tests and example code in [the 'sandbox' folder](https://github.com/jessecambon/tidygeocoder/tree/main/sandbox). +- Run `devtools::check()` to make sure the package still passes all tests and checks. To only run the package tests use `devtools::test()`, but note these tests do not query the geocoding services to avoid external dependencies. +- As a final check, run **[external/online_tests.R](https://github.com/jessecambon/tidygeocoder/blob/main/external/online_tests.R)** to test making queries to the geocoding services. These tests are not included in the internal package tests (`devtools::test()`) because they require API keys which would not exist on all systems and are dependent on the geocoding services being online at that the time of the test. +- Run the commands detailed in **[cran-comments.md](https://github.com/jessecambon/tidygeocoder/blob/main/cran-comments.md)** to test the package on other environments. Note that these tests should also be included in the automated GitHub actions tests for pull requests. +- When prepping for a release, use `urlchecker::url_check()` to check all package URLs. \ No newline at end of file diff --git a/vignettes/tidygeocoder.Rmd b/vignettes/tidygeocoder.Rmd index 17aed3dc..ca063bd5 100644 --- a/vignettes/tidygeocoder.Rmd +++ b/vignettes/tidygeocoder.Rmd @@ -13,7 +13,6 @@ vignette: > - ## Introduction Tidygeocoder provides a unified interface for performing both forward and reverse geocoding queries with a variety of geocoding services. In forward geocoding you provide an address to the geocoding service and you get latitude and longitude coordinates in return. In reverse geocoding you provide the latitude and longitude and the geocoding service will return that location's address. In both cases, other data about the location can be provided by the geocoding service. @@ -73,7 +72,7 @@ osm_s1 <- geo( lat = latitude, long = longitude ) #> Passing 2 addresses to the Nominatim single address geocoder -#> Query completed in: 2.1 seconds +#> Query completed in: 2 seconds ``` |address | latitude| longitude| @@ -88,7 +87,7 @@ Instead of single-line addresses, you can use any combination of the following a census_c1 <- address_components %>% geocode(street = street, city = cty, state = st, method = "census") #> Passing 2 addresses to the US Census batch geocoder -#> Query completed in: 1.8 seconds +#> Query completed in: 1.4 seconds ``` |street |cty |st | lat| long| @@ -105,7 +104,7 @@ census_full1 <- address_single %>% geocode( method = "census", full_results = TRUE, api_options = list(census_return_type = 'geographies') ) #> Passing 2 addresses to the US Census batch geocoder -#> Query completed in: 1.2 seconds +#> Query completed in: 1.5 seconds ``` @@ -149,7 +148,7 @@ lat_longs1 <- tibble( rev1 <- lat_longs1 %>% reverse_geocode(lat = latitude, long = longitude, address = addr, method = "osm") #> Passing 2 coordinates to the Nominatim single coordinate geocoder -#> Query completed in: 2.1 seconds +#> Query completed in: 2 seconds ``` @@ -175,9 +174,9 @@ glimpse(rev2) #> Columns: 22 #> $ lat 38.89587, 43.65348 #> $ long -77.03077, -79.38393 -#> $ address "L’Enfant's plan, Pennsylvania Avenue, Washington, District of Columbia, 20045, United S… +#> $ address "L’Enfant's plan, Pennsylvania Avenue, Washington, District of Columbia, 20045, United States", "Toronto City Hall, 100, Queen Str… #> $ place_id 301711857, 137497520 -#> $ licence "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright", "Data © OpenSt… +#> $ licence "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright", "Data © OpenStreetMap contributors, ODbL 1.0. https://os… #> $ osm_type "way", "way" #> $ osm_id 899927546, 198500761 #> $ osm_lat "38.895859599999994", "43.6536032" @@ -189,7 +188,7 @@ glimpse(rev2) #> $ postcode "20045", "M5H 2N2" #> $ country "United States", "Canada" #> $ country_code "us", "ca" -#> $ boundingbox <"38.8957273", "38.8959688", "-77.0311667", "-77.0301895">, <"43.6529946", "43.6541458",… +#> $ boundingbox <"38.8957273", "38.8959688", "-77.0311667", "-77.0301895">, <"43.6529946", "43.6541458", "-79.3848438", "-79.3830415"> #> $ amenity NA, "Toronto City Hall" #> $ house_number NA, "100" #> $ neighbourhood NA, "Financial District" @@ -289,7 +288,7 @@ cascade_results1 <- addresses_combine %>% ) #> #> Passing 3 addresses to the US Census batch geocoder -#> Query completed in: 0.1 seconds +#> Query completed in: 0.2 seconds #> Passing 2 addresses to the Nominatim single address geocoder #> Query completed in: 2 seconds ``` @@ -353,15 +352,15 @@ glimpse(geo_limit) #> $ lat -12.06211, -12.20011, -11.99997, 30.03521, 30.04439, 30.03325 #> $ long -77.03653, -76.28506, -76.83322, 31.56337, 31.23573, 31.56216 #> $ place_id 258244064, 258655931, 258306819, 258758158, 793757, 298971141 -#> $ licence "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright", "Data © OpenStre… +#> $ licence "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright", "Data © OpenStreetMap contributors, ODbL 1.0. https://osm.… #> $ osm_type "relation", "relation", "relation", "relation", "node", "relation" #> $ osm_id 1944756, 1944659, 1944670, 5466227, 271613766, 4103336 -#> $ boundingbox <"-12.0797663", "-12.0303496", "-77.0884555", "-77.0017774">, <"-13.3235137", "-10.2741856… -#> $ display_name "Lima, Lima Metropolitana, Lima, Perú", "Lima, Perú", "Lima, Lima Metropolitana, Lima, Per… +#> $ boundingbox <"-12.0797663", "-12.0303496", "-77.0884555", "-77.0017774">, <"-13.3235137", "-10.2741856", "-77.8863105", "-75.5075">, <"-12.51993… +#> $ display_name "Lima, Lima Metropolitana, Lima, Perú", "Lima, Perú", "Lima, Lima Metropolitana, Lima, Perú", "القاهرة, محافظة القاهرة, مصر", "القاه… #> $ class "boundary", "boundary", "boundary", "place", "place", "boundary" #> $ type "administrative", "administrative", "administrative", "city", "city", "administrative" #> $ importance 0.7830015, 0.6119761, 0.5934835, 0.6960286, 0.6960286, 0.4835559 -#> $ icon "https://nominatim.openstreetmap.org/ui/mapicons//poi_boundary_administrative.p.20.png", "… +#> $ icon "https://nominatim.openstreetmap.org/ui/mapicons//poi_boundary_administrative.p.20.png", "https://nominatim.openstreetmap.org/ui/map… ``` To directly specify specific API parameters for a given `method` you can use the `custom_query` parameter. For example, [the Nominatim (OSM) geocoder has a 'polygon_geojson' argument](https://nominatim.org/release-docs/develop/api/Details/#parameters) that can be used to return GeoJSON geometry content. To pass this parameter you can insert it with a named list using the `custom_query` argument: @@ -384,7 +383,7 @@ cairo_geo <- geo("Cairo, Egypt", #> polygon_geojson : "1" #> format : "json" #> HTTP Status Code: 200 -#> Query completed in: 0.2 seconds +#> Query completed in: 0.1 seconds #> Total query time (including sleep): 1 seconds #> #> Query completed in: 1 seconds diff --git a/vignettes/tidygeocoder.Rmd.orig b/vignettes/tidygeocoder.Rmd.orig index 9599866c..be46c6fb 100644 --- a/vignettes/tidygeocoder.Rmd.orig +++ b/vignettes/tidygeocoder.Rmd.orig @@ -10,26 +10,29 @@ vignette: > --- ```{r, echo = FALSE, message = FALSE} -# INSTRUCTIONS: execute this vignette with this command: +############################ INSTRUCTIONS ########################################### +# 1. Make all changes to tidygeocder.Rmd.orig +# 2. Knit the vignette with this command: +# # knitr::knit("vignettes/tidygeocoder.Rmd.orig", output = "vignettes/tidygeocoder.Rmd") # # See these instructions for more detail: # https://ropensci.org/blog/2019/12/08/precompute-vignettes/ +##################################################################################### knitr::opts_chunk$set(collapse = TRUE, comment = "#>") options(tibble.print_min = 4L, tibble.print_max = 4L) set.seed(42) ``` -```{r, echo = FALSE, message = FALSE, eval = FALSE} +```{r, echo = FALSE, message = FALSE} # check to make sure both the US Census and Nominatim endpoints are available -# (ie. we have an internet connection) -# These checks are no longer necessary as this vignette is executed locally +# (ie. we have an internet connection and neither service is down) # Check that US Census service is available tryCatch( expr = { - tidygeocoder::geo('1600 Pennsylvania Avenue NW, Washington, DC 20500', + no_output <- tidygeocoder::geo('1600 Pennsylvania Avenue NW, Washington, DC 20500', method = 'census') }, error = function(e) { @@ -47,8 +50,8 @@ tryCatch( # Check that the Nominatim service is available tryCatch( expr = { - tidygeocoder::geo('London', method = 'osm') - tidygeocoder::reverse_geo(lat = 0, long = 0, method = 'osm') + no_output <- tidygeocoder::geo('London', method = 'osm') + no_output <- tidygeocoder::reverse_geo(lat = 0, long = 0, method = 'osm') }, error = function(e) { stop(paste0('The Nominatim ("osm") geocoding API is not available. ',

    progress_bar

    if TRUE then a progress bar will be displayed to track query -progress for single input geocoding (1 input per query). By default the progress bar +

    if TRUE then a progress bar will be displayed +for single input geocoding (1 input per query). By default the progress bar will not be shown for code executed when knitting R Markdown files or code within an RStudio notebook chunk. Can be set permanently with options(tidygeocoder.progress_bar = FALSE).

    quiet

    if TRUE then console messages that are displayed by default -regarding queries will be suppressed. Can be set permanently with options(tidygeocoder.quiet = TRUE).

    api_url
    flatten

    if TRUE (default) then any nested dataframes in results are flattened if possible. -Note that in some cases results are flattened regardless such as for -Geocodio batch geocoding.

    batch_limit
    progress_bar

    if TRUE then a progress bar will be displayed to track query -progress for single input geocoding (1 input per query). By default the progress bar +

    if TRUE then a progress bar will be displayed +for single input geocoding (1 input per query). By default the progress bar will not be shown for code executed when knitting R Markdown files or code within an RStudio notebook chunk. Can be set permanently with options(tidygeocoder.progress_bar = FALSE).

    quiet

    if TRUE then console messages that are displayed by default -regarding queries will be suppressed. Can be set permanently with options(tidygeocoder.quiet = TRUE).

    api_url
    flatten

    if TRUE (default) then any nested dataframes in results are flattened if possible. -Note that in some cases results are flattened regardless such as for -Geocodio batch geocoding.

    batch_limit