Browse Source

initial commit

pull/3/merge
boB Rudis 7 years ago
commit
2a2f018f6d
No known key found for this signature in database GPG Key ID: 2A514A4997464560
  1. 10
      .Rbuildignore
  2. 1
      .codecov.yml
  3. 8
      .gitignore
  4. 31
      .travis.yml
  5. 21
      DESCRIPTION
  6. 11
      NAMESPACE
  7. 2
      NEWS.md
  8. 43
      R/geocod-auth.R
  9. 30
      R/geocod-batch.R
  10. 45
      R/geocod-one.R
  11. 39
      R/geocod-reverse-batch.R
  12. 18
      R/geocod-reverse.R
  13. 11
      R/rgeocodio-package.R
  14. 75
      README.Rmd
  15. 244
      README.md
  16. 20
      man/gio_auth.Rd
  17. 25
      man/gio_batch_geocode.Rd
  18. 23
      man/gio_batch_reverse.Rd
  19. 19
      man/gio_geocode.Rd
  20. 20
      man/gio_geocode_components.Rd
  21. 19
      man/gio_reverse.Rd
  22. 13
      man/rgeocodio.Rd
  23. 21
      rgeocodio.Rproj
  24. 2
      tests/test-all.R
  25. 6
      tests/testthat/test-rgeocodio.R

10
.Rbuildignore

@ -0,0 +1,10 @@
^.*\.Rproj$
^\.Rproj\.user$
^\.travis\.yml$
^README\.*Rmd$
^README\.*html$
^NOTES\.*Rmd$
^NOTES\.*html$
^\.codecov\.yml$
^README_files$
^doc$

1
.codecov.yml

@ -0,0 +1 @@
comment: false

8
.gitignore

@ -0,0 +1,8 @@
.DS_Store
.Rproj.user
.Rhistory
.RData
.Rproj
src/*.o
src/*.so
src/*.dll

31
.travis.yml

@ -0,0 +1,31 @@
language: r
warnings_are_errors: true
sudo: required
cache: packages
r:
- oldrel
- release
- devel
apt_packages:
- libv8-dev
- xclip
env:
global:
- CRAN: http://cran.rstudio.com
after_success:
- Rscript -e 'covr::codecov()'
notifications:
email:
- bob@rud.is
irc:
channels:
- "104.236.112.222#builds"
nick: travisci

21
DESCRIPTION

@ -0,0 +1,21 @@
Package: rgeocodio
Type: Package
Title: Tools to Work with the <geocod.io> 'API'
Version: 0.1.0
Date: 2017-03-05
Author: Bob Rudis (bob@rud.is)
Maintainer: Bob Rudis <bob@rud.is>
Description: A set of tools to Work with the <geocod.io> 'API'.
URL: https://github.com/hrbrmstr/rgeocodio
BugReports: https://github.com/hrbrmstr/rgeocodio/issues
License: AGPL
Suggests:
testthat,
covr
Depends:
R (>= 3.2.0)
Imports:
purrr,
httr,
jsonlite
RoxygenNote: 6.0.1

11
NAMESPACE

@ -0,0 +1,11 @@
# Generated by roxygen2: do not edit by hand
export(gio_auth)
export(gio_batch_geocode)
export(gio_batch_reverse)
export(gio_geocode)
export(gio_geocode_components)
export(gio_reverse)
import(httr)
import(purrr)
importFrom(jsonlite,fromJSON)

2
NEWS.md

@ -0,0 +1,2 @@
0.1.0
* Initial release

43
R/geocod-auth.R

@ -0,0 +1,43 @@
#' Get or set GEOCODIO_API_KEY value
#'
#' The API wrapper functions in this package all rely on a geocod.io API
#' key residing in the environment variables `GEOCODIO_API_KEY`. The easiest way to
#' accomplish this is to set it in the `.Renviron` file in your home directory.
#'
#' @md
#' @param force force setting a new geocod.io API key for the
#' current environment?
#' @return `list` containing the combined geocod.io API key
#' @export
gio_auth <- function(force=FALSE) {
key <- Sys.getenv('GEOCODIO_API_KEY')
if ((!identical(key, "")) && !force) {
return(key)
}
if (!interactive()) {
stop(paste0("Please set env var GEOCODIO_API_KEY",
"to your geocod.io API key", sep="", collapse=""),
call. = FALSE)
}
if (identical(key, "")) {
message("Couldn't find env var GEOCODIO_API_KEY See ?gio_auth for more details.")
message("Please enter your API key and press enter:")
pat <- readline(": ")
if (identical(pat, "")) {
stop("geocod.io API key entry failed", call. = FALSE)
}
message("Updating GEOCODIO_API_KEY env var to PAT")
Sys.setenv(GEOCODIO_API_KEY = pat)
return(pat)
}
}

30
R/geocod-batch.R

@ -0,0 +1,30 @@
#' Geocode up to 10,000 addresses
#'
#' @md
#' @param addresses character vector of addresses (10K max)
#' @param api_key `geocod.io` API key
#' @export
#' @examples
#' gio_batch_geocode(c(
#' "1109 N Highland St, Arlington VA",
#' "525 University Ave, Toronto, ON, Canada",
#' "4410 S Highway 17 92, Casselberry FL",
#' "15000 NE 24th Street, Redmond WA",
#' "17015 Walnut Grove Drive, Morgan Hill CA"
#' ))
gio_batch_geocode <- function(addresses, api_key=gio_auth()) {
if (length(addresses) > 10000) {
message("Too many addresses. Submitting first 10,000")
addresses <- addresses[1:10000]
}
res <- httr::POST("https://api.geocod.io/v1/geocode",
query=list(api_key=api_key),
body=as.list(addresses), encode="json")
httr::stop_for_status(res)
jsonlite::fromJSON(httr::content(res, as="text", encoding="UTF-8"))
}

45
R/geocod-one.R

@ -0,0 +1,45 @@
#' Geocode a single address
#'
#' @md
#' @param address address to geocode
#' @param api_key `geocod.io` API key
#' @export
#' @examples
#' gio_geocode("1109 N Highland St, Arlington, VA")
gio_geocode <- function(address, api_key=gio_auth()) {
res <- httr::GET("https://api.geocod.io/v1/geocode",
query=list(q=address, api_key=api_key))
httr::stop_for_status(res)
jsonlite::fromJSON(httr::content(res, as="text", encoding="UTF-8"))
}
#' Geocode a single address
#'
#' @md
#' @param street,city,state,postal_code,country address components
#' @param api_key `geocod.io` API key
#' @export
#' @examples
#' gio_geocode_components("1109 N Highland St", "Arlington", "VA")
gio_geocode_components <- function(street, city, state, postal_code, country,
api_key=gio_auth()) {
params <- list(api_key=api_key)
if (!missing(street)) params$street <- street
if (!missing(city)) params$city <- city
if (!missing(state)) params$state <- state
if (!missing(postal_code)) params$postal_code <- postal_code
if (!missing(country)) params$country <- country
res <- httr::GET("https://api.geocod.io/v1/geocode", query=params)
httr::stop_for_status(res)
jsonlite::fromJSON(httr::content(res, as="text", encoding="UTF-8"))
}

39
R/geocod-reverse-batch.R

@ -0,0 +1,39 @@
#' Reverse geocode up to 10,000 coordinates
#'
#' @md
#' @param coordinates data frame of coordinates with `lat` and `lon` columns
#' @param api_key `geocod.io` API key
#' @export
#' @examples
#' data.frame(
#' lat = c(35.9746000, 32.8793700, 33.8337100, 35.4171240),
#' lon = c(-77.9658000, -96.6303900, -117.8362320, -80.6784760)
#' ) -> to_code
#' gio_batch_reverse(to_code)
gio_batch_reverse <- function(coordinates, api_key=gio_auth()) {
if (nrow(coordinates) > 10000) {
message("Too many addresses. Submitting first 10,000")
coordinates <- coordinates[1:10000,]
}
if (!("lat" %in% colnames(coordinates))) {
stop("coordinates data frame must have a 'lat' column")
}
if (!("lon" %in% colnames(coordinates))) {
stop("coordinates data frame must have a 'lon' column")
}
pairs <- sprintf("%s,%s", coordinates$lat, coordinates$lon)
res <- httr::POST("https://api.geocod.io/v1/reverse",
query=list(api_key=api_key),
body=as.list(pairs), encode="json")
httr::stop_for_status(res)
jsonlite::fromJSON(httr::content(res, as="text", encoding="UTF-8"))
}

18
R/geocod-reverse.R

@ -0,0 +1,18 @@
#' Reverse geocode a single lat/lon pair
#'
#' @md
#' @param lat,lon lat/lon pair to reverse geocode
#' @param api_key `geocod.io` API key
#' @export
#' @examples
#' gio_reverse(38.9002898, -76.9990361)
gio_reverse <- function(lat, lon, api_key=gio_auth()) {
res <- httr::GET("https://api.geocod.io/v1/reverse",
query=list(q=sprintf("%s,%s", lat, lon), api_key=api_key))
httr::stop_for_status(res)
jsonlite::fromJSON(httr::content(res, as="text", encoding="UTF-8"))
}

11
R/rgeocodio-package.R

@ -0,0 +1,11 @@
#' Tools to Work with the <geocod.io> 'API'
#'
#' NOTE: You need an [API key](https://dash.geocod.io/) to use this package.
#'
#' @md
#' @name rgeocodio
#' @docType package
#' @author Bob Rudis (bob@@rud.is)
#' @import purrr httr
#' @importFrom jsonlite fromJSON
NULL

75
README.Rmd

@ -0,0 +1,75 @@
---
output: rmarkdown::github_document
---
`rgeocodio` : Tools to Work with the <https://geocod.io/> 'API'
NOTE: You need an [API key](https://dash.geocod.io/) to use this package.
The following functions are implemented:
- `gio_auth`: Get or set GEOCODIO_API_KEY value
- `gio_batch_geocode`: Geocode up to 10,000 addresses
- `gio_batch_reverse`: Reverse geocode up to 10,000 coordinates
- `gio_geocode`: Geocode a single address
- `gio_geocode_components`: Geocode a single address
- `gio_reverse`: Reverse geocode a single lat/lon pair
### TODO
- enable selection of additional fields
- better return types
- more error checking
- tests
### Installation
```{r eval=FALSE}
devtools::install_github("hrbrmstr/rgeocodio")
```
```{r message=FALSE, warning=FALSE, error=FALSE, include=FALSE}
options(width=120)
```
### Usage
```{r message=FALSE, warning=FALSE, error=FALSE}
library(rgeocodio)
# current verison
packageVersion("rgeocodio")
gio_geocode("1109 N Highland St, Arlington, VA")
gio_geocode_components("1109 N Highland St", "Arlington", "VA")
gio_reverse(38.9002898, -76.9990361)
gio_batch_geocode(c(
"1109 N Highland St, Arlington VA",
"525 University Ave, Toronto, ON, Canada",
"4410 S Highway 17 92, Casselberry FL",
"15000 NE 24th Street, Redmond WA",
"17015 Walnut Grove Drive, Morgan Hill CA"
))
data.frame(
lat = c(35.9746000, 32.8793700, 33.8337100, 35.4171240),
lon = c(-77.9658000, -96.6303900, -117.8362320, -80.6784760)
) -> to_code
gio_batch_reverse(to_code)
```
### Test Results
```{r message=FALSE, warning=FALSE, error=FALSE}
library(rgeocodio)
library(testthat)
date()
test_dir("tests/")
```

244
README.md

@ -0,0 +1,244 @@
`rgeocodio` : Tools to Work with the <https://geocod.io/> 'API'
NOTE: You need an [API key](https://dash.geocod.io/) to use this package.
The following functions are implemented:
- `gio_auth`: Get or set GEOCODIO\_API\_KEY value
- `gio_batch_geocode`: Geocode up to 10,000 addresses
- `gio_batch_reverse`: Reverse geocode up to 10,000 coordinates
- `gio_geocode`: Geocode a single address
- `gio_geocode_components`: Geocode a single address
- `gio_reverse`: Reverse geocode a single lat/lon pair
### TODO
- enable selection of additional fields
- better return types
- more error checking
- tests
### Installation
``` r
devtools::install_github("hrbrmstr/rgeocodio")
```
### Usage
``` r
library(rgeocodio)
# current verison
packageVersion("rgeocodio")
```
## [1] '0.1.0'
``` r
gio_geocode("1109 N Highland St, Arlington, VA")
```
## $input
## $input$address_components
## $input$address_components$number
## [1] "1109"
##
## $input$address_components$predirectional
## [1] "N"
##
## $input$address_components$street
## [1] "Highland"
##
## $input$address_components$suffix
## [1] "St"
##
## $input$address_components$formatted_street
## [1] "N Highland St"
##
## $input$address_components$city
## [1] "Arlington"
##
## $input$address_components$state
## [1] "VA"
##
## $input$address_components$zip
## [1] "22201"
##
## $input$address_components$country
## [1] "US"
##
##
## $input$formatted_address
## [1] "1109 N Highland St, Arlington, VA 22201"
##
##
## $results
## address_components.number address_components.predirectional address_components.street address_components.suffix
## 1 1109 N Highland St
## address_components.formatted_street address_components.city address_components.county address_components.state
## 1 N Highland St Arlington Arlington County VA
## address_components.zip address_components.country formatted_address location.lat location.lng
## 1 22201 US 1109 N Highland St, Arlington, VA 22201 38.88667 -77.09473
## accuracy accuracy_type source
## 1 1 rooftop Virginia GIS Clearinghouse
``` r
gio_geocode_components("1109 N Highland St", "Arlington", "VA")
```
## $input
## $input$address_components
## $input$address_components$number
## [1] "1109"
##
## $input$address_components$predirectional
## [1] "N"
##
## $input$address_components$street
## [1] "Highland"
##
## $input$address_components$suffix
## [1] "St"
##
## $input$address_components$formatted_street
## [1] "N Highland St"
##
## $input$address_components$city
## [1] "Arlington"
##
## $input$address_components$state
## [1] "VA"
##
## $input$address_components$zip
## [1] "22201"
##
## $input$address_components$country
## [1] "US"
##
##
## $input$formatted_address
## [1] "1109 N Highland St, Arlington, VA 22201"
##
##
## $results
## address_components.number address_components.predirectional address_components.street address_components.suffix
## 1 1109 N Highland St
## address_components.formatted_street address_components.city address_components.county address_components.state
## 1 N Highland St Arlington Arlington County VA
## address_components.zip address_components.country formatted_address location.lat location.lng
## 1 22201 US 1109 N Highland St, Arlington, VA 22201 38.88667 -77.09473
## accuracy accuracy_type source
## 1 1 rooftop Virginia GIS Clearinghouse
``` r
gio_reverse(38.9002898, -76.9990361)
```
## $results
## address_components.number address_components.street address_components.suffix address_components.postdirectional
## 1 500 H St NE
## 2 800 5th St NE
## 3 474 H St NE
## address_components.formatted_street address_components.city address_components.county address_components.state
## 1 H St NE Washington District of Columbia DC
## 2 5th St NE Washington District of Columbia DC
## 3 H St NE Washington District of Columbia DC
## address_components.zip address_components.country formatted_address location.lat location.lng
## 1 20002 US 500 H St NE, Washington, DC 20002 38.9002 -76.99951
## 2 20002 US 800 5th St NE, Washington, DC 20002 38.9002 -76.99951
## 3 20002 US 474 H St NE, Washington, DC 20002 38.9002 -76.99994
## accuracy accuracy_type source
## 1 1.00 nearest_street TIGER/Line® dataset from the US Census Bureau
## 2 0.18 nearest_street TIGER/Line® dataset from the US Census Bureau
## 3 0.18 nearest_street TIGER/Line® dataset from the US Census Bureau
``` r
gio_batch_geocode(c(
"1109 N Highland St, Arlington VA",
"525 University Ave, Toronto, ON, Canada",
"4410 S Highway 17 92, Casselberry FL",
"15000 NE 24th Street, Redmond WA",
"17015 Walnut Grove Drive, Morgan Hill CA"
))
```
## $results
## query response.input.address_components.number
## 1 1109 N Highland St, Arlington VA 1109
## 2 525 University Ave, Toronto, ON, Canada 525
## 3 4410 S Highway 17 92, Casselberry FL 4410
## 4 15000 NE 24th Street, Redmond WA 15000
## 5 17015 Walnut Grove Drive, Morgan Hill CA 17015
## response.input.address_components.predirectional response.input.address_components.street
## 1 N Highland
## 2 <NA> University
## 3 <NA> State Rte 17
## 4 NE 24th
## 5 <NA> Walnut Grove
## response.input.address_components.suffix response.input.address_components.formatted_street
## 1 St N Highland St
## 2 Ave University Ave
## 3 <NA> State Rte 17
## 4 St NE 24th St
## 5 Dr Walnut Grove Dr
## response.input.address_components.city response.input.address_components.state response.input.address_components.zip
## 1 Arlington VA 22201
## 2 Toronto ON <NA>
## 3 Casselberry FL 32707
## 4 Redmond WA 98052
## 5 Morgan Hill CA 95037
## response.input.address_components.country response.input.formatted_address
## 1 US 1109 N Highland St, Arlington, VA 22201
## 2 CA 525 University Ave, Toronto, ON
## 3 US 4410 State Rte 17, Casselberry, FL 32707
## 4 US 15000 NE 24th St, Redmond, WA 98052
## 5 US 17015 Walnut Grove Dr, Morgan Hill, CA 95037
## response.results
## 1 1109, N, Highland, St, N Highland St, Arlington, Arlington County, VA, 22201, US, 1109 N Highland St, Arlington, VA 22201, 38.886665, -77.094733, 1, rooftop, Virginia GIS Clearinghouse
## 2 525, University, Ave, University Ave, Toronto, ON, CA, 525 University Ave, Toronto, ON, 43.656258, -79.388223, 1, rooftop, City of Toronto Open Data
## 3 4410, 4410, Us Hwy 17, Us Hwy 17, Us Hwy 17, Us Hwy 17, Casselberry, Casselberry, Seminole County, Seminole County, FL, FL, 32707, 32707, US, US, 4410 Us Hwy 17, Casselberry, FL 32707, 4410 Us Hwy 17, Casselberry, FL 32707, 28.671168, 28.670668, -81.33834, -81.338163, 1, 0.8, range_interpolation, range_interpolation, TIGER/Line® dataset from the US Census Bureau, TIGER/Line® dataset from the US Census Bureau
## 4 15000, 15000, NE, NE, 24th, 24th, St, St, NE 24th St, NE 24th St, Redmond, Redmond, King County, King County, WA, WA, 98052, 98052, US, US, 15000 NE 24th St, Redmond, WA 98052, 15000 NE 24th St, Redmond, WA 98052, 47.631663, 47.631363, -122.141532, -122.141535, 1, 0.8, range_interpolation, range_interpolation, TIGER/Line® dataset from the US Census Bureau, TIGER/Line® dataset from the US Census Bureau
## 5 Walnut Grove, Dr, Walnut Grove Dr, Morgan Hill, Santa Clara County, CA, 95037, US, Walnut Grove Dr, Morgan Hill, CA 95037, 37.138619, -121.64061, 0.8, street_center, TIGER/Line® dataset from the US Census Bureau
``` r
data.frame(
lat = c(35.9746000, 32.8793700, 33.8337100, 35.4171240),
lon = c(-77.9658000, -96.6303900, -117.8362320, -80.6784760)
) -> to_code
gio_batch_reverse(to_code)
```
## $results
## query
## 1 35.9746,-77.9658
## 2 32.87937,-96.63039
## 3 33.83371,-117.836232
## 4 35.417124,-80.678476
## results
## 1 101, 100, 125, State Hwy 58, Alston, Alston, State Hwy 58, N Alston St, S Alston St, Nashville, Nashville, Nashville, Nash County, Nash County, Nash County, NC, NC, NC, 27856, 27856, 27856, US, US, US, NA, N, S, NA, St, St, 101 State Hwy 58, Nashville, NC 27856, 100 N Alston St, Nashville, NC 27856, 125 S Alston St, Nashville, NC 27856, 35.974536, 35.974536, 35.974263, -77.965716, -77.965716, -77.965823, 1, 0.37, 0.36, nearest_street, nearest_street, nearest_street, TIGER/Line® dataset from the US Census Bureau, TIGER/Line® dataset from the US Census Bureau, TIGER/Line® dataset from the US Census Bureau
## 2 100, 2961, 3084, E, S, S, Kingsley, 1st, 1st, Rd, St, St, E Kingsley Rd, S 1st St, S 1st St, Garland, Garland, Garland, Dallas County, Dallas County, Dallas County, TX, TX, TX, 75041, 75041, 75041, US, US, US, 100 E Kingsley Rd, Garland, TX 75041, 2961 S 1st St, Garland, TX 75041, 3084 S 1st St, Garland, TX 75041, 32.878693, 32.881541, 32.878897, -96.630918, -96.630962, -96.630992, 1, 0.92, 0.87, nearest_street, nearest_street, nearest_street, TIGER/Line® dataset from the US Census Bureau, TIGER/Line® dataset from the US Census Bureau, TIGER/Line® dataset from the US Census Bureau
## 3 2700, 2566, 2790, N, N, N, Tustin, Tustin, Tustin, St, St, St, N Tustin St, N Tustin St, N Tustin St, Orange, Orange, Orange, Orange County, Orange County, Orange County, CA, CA, CA, 92865, 92865, 92865, US, US, US, 2700 N Tustin St, Orange, CA 92865, 2566 N Tustin St, Orange, CA 92865, 2790 N Tustin St, Orange, CA 92865, 33.832923, 33.830224, 33.834775, -117.836211, -117.836152, -117.836249, 1, 0, 0, nearest_street, nearest_street, nearest_street, TIGER/Line® dataset from the US Census Bureau, TIGER/Line® dataset from the US Census Bureau, TIGER/Line® dataset from the US Census Bureau
## 4 5968, 5500, 450, Village, York, Sportsman, Dr, St, Dr, NW, NW, NA, Village Dr NW, York St NW, Sportsman Dr, Concord, Concord, Concord, Cabarrus County, Cabarrus County, Cabarrus County, NC, NC, NC, 28027, 28027, 28027, US, US, US, 5968 Village Dr NW, Concord, NC 28027, 5500 York St NW, Concord, NC 28027, 450 Sportsman Dr, Concord, NC 28027, 35.413592, 35.41373, 35.420958, -80.675786, -80.67508, -80.675289, 1, 0.92, 0.89, nearest_street, nearest_street, nearest_street, TIGER/Line® dataset from the US Census Bureau, TIGER/Line® dataset from the US Census Bureau, TIGER/Line® dataset from the US Census Bureau
### Test Results
``` r
library(rgeocodio)
library(testthat)
date()
```
## [1] "Sun Mar 5 14:40:22 2017"
``` r
test_dir("tests/")
```
## testthat results ========================================================================================================
## OK: 0 SKIPPED: 0 FAILED: 0
##
## DONE ===================================================================================================================

20
man/gio_auth.Rd

@ -0,0 +1,20 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geocod-auth.R
\name{gio_auth}
\alias{gio_auth}
\title{Get or set GEOCODIO_API_KEY value}
\usage{
gio_auth(force = FALSE)
}
\arguments{
\item{force}{force setting a new geocod.io API key for the
current environment?}
}
\value{
\code{list} containing the combined geocod.io API key
}
\description{
The API wrapper functions in this package all rely on a geocod.io API
key residing in the environment variables \code{GEOCODIO_API_KEY}. The easiest way to
accomplish this is to set it in the \code{.Renviron} file in your home directory.
}

25
man/gio_batch_geocode.Rd

@ -0,0 +1,25 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geocod-batch.R
\name{gio_batch_geocode}
\alias{gio_batch_geocode}
\title{Geocode up to 10,000 addresses}
\usage{
gio_batch_geocode(addresses, api_key = gio_auth())
}
\arguments{
\item{addresses}{character vector of addresses (10K max)}
\item{api_key}{\code{geocod.io} API key}
}
\description{
Geocode up to 10,000 addresses
}
\examples{
gio_batch_geocode(c(
"1109 N Highland St, Arlington VA",
"525 University Ave, Toronto, ON, Canada",
"4410 S Highway 17 92, Casselberry FL",
"15000 NE 24th Street, Redmond WA",
"17015 Walnut Grove Drive, Morgan Hill CA"
))
}

23
man/gio_batch_reverse.Rd

@ -0,0 +1,23 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geocod-reverse-batch.R
\name{gio_batch_reverse}
\alias{gio_batch_reverse}
\title{Reverse geocode up to 10,000 coordinates}
\usage{
gio_batch_reverse(coordinates, api_key = gio_auth())
}
\arguments{
\item{coordinates}{data frame of coordinates with \code{lat} and \code{lon} columns}
\item{api_key}{\code{geocod.io} API key}
}
\description{
Reverse geocode up to 10,000 coordinates
}
\examples{
data.frame(
lat = c(35.9746000, 32.8793700, 33.8337100, 35.4171240),
lon = c(-77.9658000, -96.6303900, -117.8362320, -80.6784760)
) -> to_code
gio_batch_reverse(to_code)
}

19
man/gio_geocode.Rd

@ -0,0 +1,19 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geocod-one.R
\name{gio_geocode}
\alias{gio_geocode}
\title{Geocode a single address}
\usage{
gio_geocode(address, api_key = gio_auth())
}
\arguments{
\item{address}{address to geocode}
\item{api_key}{\code{geocod.io} API key}
}
\description{
Geocode a single address
}
\examples{
gio_geocode("1109 N Highland St, Arlington, VA")
}

20
man/gio_geocode_components.Rd

@ -0,0 +1,20 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geocod-one.R
\name{gio_geocode_components}
\alias{gio_geocode_components}
\title{Geocode a single address}
\usage{
gio_geocode_components(street, city, state, postal_code, country,
api_key = gio_auth())
}
\arguments{
\item{street, city, state, postal_code, country}{address components}
\item{api_key}{\code{geocod.io} API key}
}
\description{
Geocode a single address
}
\examples{
gio_geocode_components("1109 N Highland St", "Arlington", "VA")
}

19
man/gio_reverse.Rd

@ -0,0 +1,19 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/geocod-reverse.R
\name{gio_reverse}
\alias{gio_reverse}
\title{Reverse geocode a single lat/lon pair}
\usage{
gio_reverse(lat, lon, api_key = gio_auth())
}
\arguments{
\item{lat, lon}{lat/lon pair to reverse geocode}
\item{api_key}{\code{geocod.io} API key}
}
\description{
Reverse geocode a single lat/lon pair
}
\examples{
gio_reverse(38.9002898, -76.9990361)
}

13
man/rgeocodio.Rd

@ -0,0 +1,13 @@
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/rgeocodio-package.R
\docType{package}
\name{rgeocodio}
\alias{rgeocodio}
\alias{rgeocodio-package}
\title{Tools to Work with the <geocod.io> 'API'}
\description{
NOTE: You need an \href{https://dash.geocod.io/}{API key} to use this package.
}
\author{
Bob Rudis (bob@rud.is)
}

21
rgeocodio.Rproj

@ -0,0 +1,21 @@
Version: 1.0
RestoreWorkspace: Default
SaveWorkspace: Default
AlwaysSaveHistory: Default
EnableCodeIndexing: Yes
UseSpacesForTab: Yes
NumSpacesForTab: 2
Encoding: UTF-8
RnwWeave: Sweave
LaTeX: pdfLaTeX
StripTrailingWhitespace: Yes
BuildType: Package
PackageUseDevtools: Yes
PackageInstallArgs: --no-multiarch --with-keep.source
PackageBuildArgs: --resave-data
PackageRoxygenize: rd,collate,namespace

2
tests/test-all.R

@ -0,0 +1,2 @@
library(testthat)
test_check("rgeocodio")

6
tests/testthat/test-rgeocodio.R

@ -0,0 +1,6 @@
context("basic functionality")
test_that("we can do something", {
#expect_that(some_function(), is_a("data.frame"))
})
Loading…
Cancel
Save