Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

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

:globe_with_meridians: query openrouteservice API from R
https://github.com/giscience/openrouteservice-r

api directions gis giscience isochrones openrouteservice openstreetmap pois r routing sdk

Last synced: 4 days ago
JSON representation

:globe_with_meridians: query openrouteservice API from R

Awesome Lists containing this project

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-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)

# 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: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('^', '', lines)
lines = gsub('^
', '', lines)
lines = gsub('
$', '', lines)
cat(paste(lines, collapse = "\n"))
```