{"id":13857549,"url":"https://github.com/crazycapivara/graphhopper-r","last_synced_at":"2025-06-14T14:32:59.169Z","repository":{"id":48622046,"uuid":"177181695","full_name":"crazycapivara/graphhopper-r","owner":"crazycapivara","description":"An R Interface to the graphhopper API","archived":false,"fork":false,"pushed_at":"2021-07-17T10:40:26.000Z","size":900,"stargazers_count":19,"open_issues_count":4,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-12T20:49:46.009Z","etag":null,"topics":["api-client","graphhopper","r","routing-engine","rspatial","rstats","travel-times"],"latest_commit_sha":null,"homepage":"https://crazycapivara.github.io/graphhopper-r/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/crazycapivara.png","metadata":{"files":{"readme":"README.Rmd","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-22T17:17:57.000Z","updated_at":"2024-11-02T10:53:33.000Z","dependencies_parsed_at":"2022-09-15T20:51:47.718Z","dependency_job_id":null,"html_url":"https://github.com/crazycapivara/graphhopper-r","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/crazycapivara/graphhopper-r","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazycapivara%2Fgraphhopper-r","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazycapivara%2Fgraphhopper-r/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazycapivara%2Fgraphhopper-r/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazycapivara%2Fgraphhopper-r/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/crazycapivara","download_url":"https://codeload.github.com/crazycapivara/graphhopper-r/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/crazycapivara%2Fgraphhopper-r/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259830588,"owners_count":22918337,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","graphhopper","r","routing-engine","rspatial","rstats","travel-times"],"created_at":"2024-08-05T03:01:40.301Z","updated_at":"2025-06-14T14:32:59.126Z","avatar_url":"https://github.com/crazycapivara.png","language":"R","funding_links":[],"categories":["R"],"sub_categories":[],"readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r setup, include = FALSE}\nlibrary(ggplot2)\n\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\"\n  #,out.width = \"400px\"\n)\n```\n# graphhopper-R\n\n\u003c!-- badges: start --\u003e\n[![CRAN status](https://www.r-pkg.org/badges/version/graphhopper)](https://CRAN.R-project.org/package=graphhopper)\n[![github_status_badge](https://img.shields.io/badge/github-0.1.3-blue.svg)](https://github.com/crazycapivara/graphhopper-r/releases/latest)\n[![Travis build status](https://travis-ci.org/crazycapivara/graphhopper-r.svg?branch=master)](https://travis-ci.org/crazycapivara/graphhopper-r)\n[![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)\n[![R build status](https://github.com/crazycapivara/graphhopper-r/workflows/R-CMD-check/badge.svg)](https://github.com/crazycapivara/graphhopper-r/actions)\n\u003c!-- badges: end --\u003e\n\nAn R Interface to the [GraphHopper](https://www.graphhopper.com/) Directions API\n\nThe 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.\n\nDive into the [documentation here](https://crazycapivara.github.io/graphhopper-r/).\n\n## Installation\n\nInstall the release version from [CRAN](https://cran.r-project.org/) with:\n\n```r\ninstall.packages(\"graphhopper\")\n```\n\nInstall the development version from [GitHub](https://github.com/) with:\n\n```r\n# install.packages(\"remotes\")\nremotes::install_github(\"crazycapivara/graphhopper-r\")\n```\n\n## Get started\n\nRun your own GraphHopper instance (with data of Berlin):\n\n```bash\ndocker run --name gh --rm -p 8989:8989 -d graphhopper/graphhopper:2.0\n```\n\n### Setup\n\n```{r example}\nlibrary(graphhopper)\n\nAPI_URL \u003c- \"http://localhost:8989\"\n# API_URL \u003c- \"https://graphhopper.com/api/1/\"\ngh_set_api_url(API_URL)\n\ninfo \u003c- gh_get_info()\n\ninfo$version\ninfo$data_date\ngh_bbox(info)\n```\n\nIf you use the [GraphHopper Web Service](https://graphhopper.com/api/1/) instead of a local instance it is recommended that you store your API key in an environment variable called `GH_API_KEY`. Alternatively, you can pass the key as parameter to the `gh_get_*` functions.\n\n### Route\n\nGet a route in Berlin:\n\n```{r route-example}\nstart_point \u003c- c(52.592204, 13.414307)\nend_point \u003c- c(52.539614, 13.364868)\n\n(route \u003c- gh_get_route(list(start_point, end_point)) %\u003e%\n    gh_as_sf())\n\nggplot(data = route) +\n  geom_sf() +\n  theme(axis.text.x = element_text(angle = 45))\n\nroute$time\n\nvia_point \u003c- c(52.545461, 13.435249)\n\nroute2 \u003c- gh_get_route(list(start_point, via_point, end_point))\n\ngh_time_distance(route2)\n\nggplot(data = gh_as_sf(route2)) +\n  geom_sf() +\n  theme(axis.text.x = element_text(angle = 45))\n\ngh_points(route2) %\u003e%\n  head()\n\ngh_instructions(route2)[, c(\"lon\", \"lat\", \"gh_id\", \"gh_end_id\", \"text\", \"distance\")] %\u003e%\n  head()\n```\n\n### Shortest path tree\n\n```{r spt-example}\nstart_point \u003c- c(52.53961, 13.36487)\n\npoints_sf \u003c- gh_get_spt(start_point, time_limit = 180) %\u003e%\n  gh_as_sf() %\u003e%\n  dplyr::mutate(time = (time / 1000 / 60))\n\nggplot() +\n  geom_sf(data = points_sf, aes(colour = time), size = 0.5) +\n  theme(axis.text.x = element_text(angle = 45))\n```\n\nAlso query previous nodes to plot the network:\n\n```{r spt-example-lines}\n(columns \u003c- gh_spt_columns(\n  prev_longitude = TRUE,\n  prev_latitude = TRUE,\n  prev_time = TRUE\n))\n\nlines_sf \u003c- gh_get_spt(end_point, time_limit = 240, columns = columns) %\u003e%\n  dplyr::mutate(mean_time = ((time + prev_time) / 2) / 1000 / 60) %\u003e%\n  gh_spt_as_linestrings_sf()\n\nggplot() +\n  geom_sf(data = lines_sf, aes(color = mean_time), size = 1) +\n  theme(axis.text.x = element_text(angle = 45))\n```\n\n### Isochrone\n\n```{r isochrone-example}\nstart_point \u003c- c(52.53961, 13.36487)\n\nisochrone_sf \u003c- gh_get_isochrone(start_point, time_limit = 180) %\u003e%\n  gh_as_sf()\n\nggplot() +\n  geom_sf(data = isochrone_sf, fill = \"yellow\") +\n  geom_sf(data = points_sf, aes(colour = time), size = 0.5) +\n  theme(axis.text.x = element_text(angle = 45))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrazycapivara%2Fgraphhopper-r","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcrazycapivara%2Fgraphhopper-r","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcrazycapivara%2Fgraphhopper-r/lists"}