Skip to content

Commit

Permalink
Update README
Browse files Browse the repository at this point in the history
  • Loading branch information
crazycapivara committed Dec 5, 2020
1 parent ac5824c commit b304365
Show file tree
Hide file tree
Showing 7 changed files with 45 additions and 24 deletions.
2 changes: 2 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ knitr::opts_chunk$set(

<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/graphhopper)](https://CRAN.R-project.org/package=graphhopper)
[![github_status_badge](https://img.shields.io/badge/github-0.1.2-blue.svg)](https://github.com/crazycapivara/deckgl/releases/latest)
[![Travis build status](https://travis-ci.org/crazycapivara/graphhopper-r.svg?branch=master)](https://travis-ci.org/crazycapivara/graphhopper-r)
[![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![R build status](https://github.com/crazycapivara/graphhopper-r/workflows/R-CMD-check/badge.svg)](https://github.com/crazycapivara/graphhopper-r/actions)
Expand Down Expand Up @@ -143,5 +144,6 @@ isochrone_sf <- gh_get_isochrone(start_point, time_limit = 180) %>%
ggplot() +
geom_sf(data = isochrone_sf, fill = "yellow") +
geom_sf(data = points_sf, aes(colour = time), size = 0.5) +
theme(axis.text.x = element_text(angle = 45))
```
67 changes: 43 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,40 @@

<!-- README.md is generated from README.Rmd. Please edit that file -->
graphhopper-R
=============

<!-- badges: start -->
[![CRAN status](https://www.r-pkg.org/badges/version/graphhopper)](https://CRAN.R-project.org/package=graphhopper) [![Travis build status](https://travis-ci.org/crazycapivara/graphhopper-r.svg?branch=master)](https://travis-ci.org/crazycapivara/graphhopper-r) [![Project Status: Active – The project has reached a stable, usable state and is being actively developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active) [![R build status](https://github.com/crazycapivara/graphhopper-r/workflows/R-CMD-check/badge.svg)](https://github.com/crazycapivara/graphhopper-r/actions) <!-- badges: end -->

An R Interface to the [GraphHopper](https://www.graphhopper.com/) Directions API

The purpose of {graphhopper} is to provide a quick and easy access to the GraphHopper Directions API. Responses can be converted into simple feature (sf) objects in a convenient way. The package is not a complete wrapper of the API. Currently it mainly supports the API also included in [Graphhopper's Open Source routing engine](https://github.com/graphhopper/graphhopper). New features will be added continuously.
# graphhopper-R

Dive into the [documentation here](https://crazycapivara.github.io/graphhopper-r/).

Installation
------------
<!-- badges: start -->

Install the release version from [CRAN](https://cran.r-project.org/) with:
[![CRAN
status](https://www.r-pkg.org/badges/version/graphhopper)](https://CRAN.R-project.org/package=graphhopper)
[![github\_status\_badge](https://img.shields.io/badge/github-0.1.2-blue.svg)](https://github.com/crazycapivara/deckgl/releases/latest)
[![Travis build
status](https://travis-ci.org/crazycapivara/graphhopper-r.svg?branch=master)](https://travis-ci.org/crazycapivara/graphhopper-r)
[![Project Status: Active – The project has reached a stable, usable
state and is being actively
developed.](https://www.repostatus.org/badges/latest/active.svg)](https://www.repostatus.org/#active)
[![R build
status](https://github.com/crazycapivara/graphhopper-r/workflows/R-CMD-check/badge.svg)](https://github.com/crazycapivara/graphhopper-r/actions)
<!-- badges: end -->

An R Interface to the [GraphHopper](https://www.graphhopper.com/)
Directions API

The purpose of {graphhopper} is to provide a quick and easy access to
the GraphHopper Directions API. Responses can be converted into simple
feature (sf) objects in a convenient way. The package is not a complete
wrapper of the API. Currently it mainly supports the API also included
in [Graphhopper’s Open Source routing
engine](https://github.com/graphhopper/graphhopper). New features will
be added continuously.

Dive into the [documentation
here](https://crazycapivara.github.io/graphhopper-r/).

## Installation

Install the release version from [CRAN](https://cran.r-project.org/)
with:

``` r
install.packages("graphhopper")
Expand All @@ -28,8 +47,7 @@ Install the development version from [GitHub](https://github.com/) with:
remotes::install_github("crazycapivara/graphhopper-r")
```

Get started
-----------
## Get started

Run your own GraphHopper instance (with data of Berlin):

Expand All @@ -50,9 +68,9 @@ info <- gh_get_info()
info$version
#> [1] "2.0"
info$data_date
#> [1] "2020-11-10T21:42:03Z"
#> [1] "2020-12-04T21:42:03Z"
gh_bbox(info)
#> [1] 13.06979 52.33306 13.76408 52.67962
#> [1] 13.06979 52.33306 13.76352 52.67962
```

### Route
Expand All @@ -71,19 +89,19 @@ end_point <- c(52.539614, 13.364868)
#> bbox: xmin: 13.36501 ymin: 52.53949 xmax: 13.41483 ymax: 52.59234
#> CRS: EPSG:4326
#> time distance geometry
#> 1 697411 7541.318 LINESTRING (13.41422 52.592...
#> 1 697420 7541.438 LINESTRING (13.41422 52.592...

ggplot(data = route) +
geom_sf() +
theme(axis.text.x = element_text(angle = 45))
```

![](man/figures/README-route-example-1.png)
![](man/figures/README-route-example-1.png)<!-- -->

``` r

route$time
#> [1] 697411
#> [1] 697420

via_point <- c(52.545461, 13.435249)

Expand All @@ -101,7 +119,7 @@ ggplot(data = gh_as_sf(route2)) +
theme(axis.text.x = element_text(angle = 45))
```

![](man/figures/README-route-example-2.png)
![](man/figures/README-route-example-2.png)<!-- -->

``` r

Expand Down Expand Up @@ -147,7 +165,7 @@ ggplot() +
theme(axis.text.x = element_text(angle = 45))
```

![](man/figures/README-spt-example-1.png)
![](man/figures/README-spt-example-1.png)<!-- -->

Also query previous nodes to plot the network:

Expand All @@ -169,7 +187,7 @@ ggplot() +
theme(axis.text.x = element_text(angle = 45))
```

![](man/figures/README-spt-example-lines-1.png)
![](man/figures/README-spt-example-lines-1.png)<!-- -->

### Isochrone

Expand All @@ -181,7 +199,8 @@ isochrone_sf <- gh_get_isochrone(start_point, time_limit = 180) %>%

ggplot() +
geom_sf(data = isochrone_sf, fill = "yellow") +
geom_sf(data = points_sf, aes(colour = time), size = 0.5) +
theme(axis.text.x = element_text(angle = 45))
```

![](man/figures/README-isochrone-example-1.png)
![](man/figures/README-isochrone-example-1.png)<!-- -->
Binary file modified man/figures/README-isochrone-example-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-route-example-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-route-example-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-spt-example-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified man/figures/README-spt-example-lines-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit b304365

Please sign in to comment.