Get data from Openaddresses

Share:

Description

Get data from Openaddresses

Usage

1
oa_get(x, overwrite = FALSE, ...)

Arguments

x

(character) URL for an openaddresses dataset, or an object of class openadd

overwrite

(logical) Will only overwrite existing path if TRUE

...

Pass on curl options to GET

Value

a tibble (a data.frame), with attributes for original url and path on disk

References

http://openaddresses.io/

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
## Not run: 
dat <- oa_list()
urls <- na.omit(dat$processed)
(out1 <- oa_get(urls[6]))
(out3 <- oa_get(urls[32]))
(out4 <- oa_get(urls[876]))
(out5 <- oa_get(urls[376]))
(out6 <- oa_get(urls[474]))
(out7 <- oa_get(urls[121]))
(out8 <- oa_get(urls[41]))
(out9 <- oa_get(urls[400]))

# from a openadd class object
oa_get(as_openadd(country="us", state="nv", city="las_vegas"))

# combine data sets
(alldat <- oa_combine(out1, out3))

# Map data
if (!requireNamespace("leaflet")) {
  install.packages("leaflet")
}
library("leaflet")
small <- out9[1:10000L, ]
leaflet(small) %>%
  addTiles() %>%
  addCircles(lat = ~LAT, lng = ~LON,
             popup = unname(apply(small[, c('NUMBER', 'STREET')], 1, paste, collapse = " ")))

## End(Not run)