Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/GIScience/openrouteservice-r

:globe_with_meridians: R package to query openrouteservice.org
https://github.com/GIScience/openrouteservice-r

api directions gis giscience isochrones openrouteservice openstreetmap pois r routing sdk

Last synced: about 2 months ago
JSON representation

:globe_with_meridians: R package to query openrouteservice.org

Lists

README

        

---
output: rmarkdown::md_document
---
[![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-experimental.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)

# openrouteservice R client

```{r readme, echo = FALSE, results = 'asis'}
lines = readLines("vignettes/openrouteservice.Rmd")
ids = grep("", 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
. In order to query a different openrouteservice
instance, say a local one, set

```{r openrouteservice.url, eval=FALSE}
options(openrouteservice.url = "http://localhost:8080/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 = 3
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"))
```