gh_as_sf: Convert a gh object into an sf object

Description Usage Arguments Examples

View source: R/as-sf.R

Description

Convert a gh object into an sf object

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
gh_as_sf(data, ...)

## S3 method for class 'gh_route'
gh_as_sf(data, ..., geom_type = c("linestring",
  "point"))

## S3 method for class 'gh_spt'
gh_as_sf(data, ...)

## S3 method for class 'gh_isochrone'
gh_as_sf(data, ...)

Arguments

data

A gh_route or gh_spt object.

...

ignored

geom_type

Use geom_type = point to return the points of the route with ids corresponding to the instruction ids.

Examples

1
2
3
4
5
6
7
if (FALSE) {
  start_point <- c(52.592204, 13.414307)
  end_point <- c(52.539614, 13.364868)

  route_sf <- gh_get_route(list(start_point, end_point)) %>%
    gh_as_sf()
}

graphhopper documentation built on Feb. 6, 2021, 5:05 p.m.