-
Notifications
You must be signed in to change notification settings - Fork 22
/
Copy pathREADME.Rmd
80 lines (64 loc) · 3.22 KB
/
README.Rmd
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
---
output: rmarkdown::md_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
<!-- badges: start -->
[![R-CMD-check](https://github.com/GIScience/openrouteservice-r/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/GIScience/openrouteservice-r/actions/workflows/R-CMD-check.yaml)
[![Coverage Status](https://img.shields.io/codecov/c/github/GIScience/openrouteservice-r/master.svg)](https://app.codecov.io/github/GIScience/openrouteservice-r?branch=master)
[![lifecycle](https://lifecycle.r-lib.org/articles/figures/lifecycle-stable.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
[![CRAN checks](https://badges.cranchecks.info/summary/openrouteservice.svg)](https://cran.r-project.org/web/checks/check_results_openrouteservice.html)
[![CRAN release](https://www.r-pkg.org/badges/version-ago/openrouteservice)](https://cran.r-project.org/package=openrouteservice)
[![CRAN downloads](https://cranlogs.r-pkg.org:443/badges/openrouteservice)](https://cran.r-project.org/package=openrouteservice)
<!-- badges: end -->
# openrouteservice R client
```{r readme, echo = FALSE, results = 'asis'}
lines = readLines("vignettes/openrouteservice.Rmd")
ids = grep("<!-- README (START|END) -->", lines) + c(1, -1)
readme = lines[do.call(":", as.list(ids))]
readme = gsub("^#(#+)(.*)", "\\1\\2", readme)
cat(knitr::knit_child(text=readme, quiet=TRUE))
```
## Get started
See the package
[vignette](https://giscience.github.io/openrouteservice-r/articles/openrouteservice.html)
for an overview of the offered functionality.
## Local ORS instance
The default is to fire any requests against the free public services at
<api.openrouteservice.org>. In order to query a different openrouteservice
instance, say a local one, set
```{r openrouteservice.url, eval=FALSE}
options(openrouteservice.url = "http://localhost:8082/ors")
```
If necessary, endpoint configuration can be further customized through
`openrouteservice.paths` which specifies a named list of paths. The defaults are
equivalent of having
```{r openrouteservice.paths, echo=FALSE, comment=NA}
opts_str <- "options(openrouteservice.paths = %s)"
nch <- nchar(opts_str) + 1L
ors_paths <- unlist(strsplit(deparse(openrouteservice:::ors_path(), 500L), ","))
indent <- paste0(rep(" ", nch), collapse="")
cat(sprintf(opts_str, paste0(ors_paths, collapse = paste(",", indent, sep="\n"))))
options(openrouteservice.path = list(directions = "v2/directions"))
```
## Package news
```{r news, echo = FALSE, results = 'asis'}
lines = readLines("NEWS.md")
lines = gsub("^# openrouteservice (.*)", "# version \\1", lines)
versions = grep("^# ", lines)
## select only n latest news
n = 4
from = 1
to = if (length(versions) > n) versions[n+1]-1 else length(lines)
news = lines[from:to]
news = gsub("^(#+)(.*)", "##\\1\\2", news)
cat(paste(news, collapse = "\n"))
```
## Publications using openrouteservice R package
Please feel free to reach out if you would like to have your work added to the list below.
```{r references, echo = FALSE, results = 'asis'}
lines = readLines("references.md")
lines = gsub('^<span class="csl-left-margin">', '', lines)
lines = gsub('^</span><span class="csl-right-inline">', '', lines)
lines = gsub(' </span>$', '', lines)
cat(paste(lines, collapse = "\n"))
```