json2sf_cs: Convert output from CycleStreets.net into sf object

Description Usage Arguments Examples

Description

Convert output from CycleStreets.net into sf object

Usage

1
json2sf_cs(obj, cols = NULL)

Arguments

obj

Object from CycleStreets.net read-in with

cols

Columns to be included in the result, a character vector or NULL for all available columns (see details for default)

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
from = "Leeds Rail Station"
to = "University of Leeds"
# save result from the API call to journey.json
# res_json = stplanr::route_cyclestreet(from, to, silent = FALSE, save_raw = TRUE)
# jsonlite::write_json(res_json, "inst/extdata/journey.json")
f = system.file(package = "cyclestreets", "extdata/journey.json")
obj = jsonlite::read_json(f, simplifyVector = TRUE)
rsf = json2sf_cs(obj)
sf:::plot.sf(rsf)
json2sf_cs(obj, cols = c("time", "busynance", "elevations"))

Robinlovelace/cyclestreets documentation built on May 14, 2019, 6:07 a.m.