-
Notifications
You must be signed in to change notification settings - Fork 0
/
entrypoint.R
executable file
·36 lines (27 loc) · 994 Bytes
/
entrypoint.R
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
31
32
33
34
35
36
#!/usr/local/bin/Rscript
dht::greeting()
## load libraries without messages or warnings
withr::with_message_sink("/dev/null", library(dplyr))
withr::with_message_sink("/dev/null", library(tidyr))
withr::with_message_sink("/dev/null", library(sf))
doc <- "
Usage:
entrypoint.R <filename> [<buffer_radius>]
"
opt <- docopt::docopt(doc)
if (is.null(opt$buffer_radius)) {
opt$buffer_radius <- 400
} else {
opt$buffer_radius <- as.numeric(opt$buffer_radius)
}
## for interactive testing
## opt <- docopt::docopt(doc, args = 'test/my_address_file_geocoded.csv')
## opt <- docopt::docopt(doc, args = 'my_address_file_geocoded.csv')
message("reading input file...")
d <- dht::read_lat_lon_csv(opt$filename) %>%
select(-.row)
## add code here to calculate geomarkers
d <- addAadtData::add_aadt(d, opt$buffer_radius)
dht::write_geomarker_file(d = d,
filename = opt$filename,
argument = glue::glue('{opt$buffer_radius}m_buffer'))