|
| 1 | +--- |
| 2 | +output: rmarkdown::github_document |
| 3 | +--- |
| 4 | + |
| 5 | +`rgeocodio` : Tools to Work with the <https://geocod.io/> 'API' |
| 6 | + |
| 7 | +NOTE: You need an [API key](https://dash.geocod.io/) to use this package. |
| 8 | + |
| 9 | +The following functions are implemented: |
| 10 | + |
| 11 | +- `gio_auth`: Get or set GEOCODIO_API_KEY value |
| 12 | +- `gio_batch_geocode`: Geocode up to 10,000 addresses |
| 13 | +- `gio_batch_reverse`: Reverse geocode up to 10,000 coordinates |
| 14 | +- `gio_geocode`: Geocode a single address |
| 15 | +- `gio_geocode_components`: Geocode a single address |
| 16 | +- `gio_reverse`: Reverse geocode a single lat/lon pair |
| 17 | + |
| 18 | +### TODO |
| 19 | + |
| 20 | +- enable selection of additional fields |
| 21 | +- better return types |
| 22 | +- more error checking |
| 23 | +- tests |
| 24 | + |
| 25 | +### Installation |
| 26 | + |
| 27 | +```{r eval=FALSE} |
| 28 | +devtools::install_github("hrbrmstr/rgeocodio") |
| 29 | +``` |
| 30 | + |
| 31 | +```{r message=FALSE, warning=FALSE, error=FALSE, include=FALSE} |
| 32 | +options(width=120) |
| 33 | +``` |
| 34 | + |
| 35 | +### Usage |
| 36 | + |
| 37 | +```{r message=FALSE, warning=FALSE, error=FALSE} |
| 38 | +library(rgeocodio) |
| 39 | +
|
| 40 | +# current verison |
| 41 | +packageVersion("rgeocodio") |
| 42 | +
|
| 43 | +gio_geocode("1109 N Highland St, Arlington, VA") |
| 44 | +
|
| 45 | +gio_geocode_components("1109 N Highland St", "Arlington", "VA") |
| 46 | +
|
| 47 | +gio_reverse(38.9002898, -76.9990361) |
| 48 | +
|
| 49 | +gio_batch_geocode(c( |
| 50 | + "1109 N Highland St, Arlington VA", |
| 51 | + "525 University Ave, Toronto, ON, Canada", |
| 52 | + "4410 S Highway 17 92, Casselberry FL", |
| 53 | + "15000 NE 24th Street, Redmond WA", |
| 54 | + "17015 Walnut Grove Drive, Morgan Hill CA" |
| 55 | +)) |
| 56 | +
|
| 57 | +data.frame( |
| 58 | + lat = c(35.9746000, 32.8793700, 33.8337100, 35.4171240), |
| 59 | + lon = c(-77.9658000, -96.6303900, -117.8362320, -80.6784760) |
| 60 | +) -> to_code |
| 61 | +
|
| 62 | +gio_batch_reverse(to_code) |
| 63 | +``` |
| 64 | + |
| 65 | +### Test Results |
| 66 | + |
| 67 | +```{r message=FALSE, warning=FALSE, error=FALSE} |
| 68 | +library(rgeocodio) |
| 69 | +library(testthat) |
| 70 | +
|
| 71 | +date() |
| 72 | +
|
| 73 | +test_dir("tests/") |
| 74 | +``` |
| 75 | + |
0 commit comments