Learn R Programming

cyclestreets (version 0.1.5)

json2sf_cs: Convert output from CycleStreets.net into sf object

Description

Convert output from CycleStreets.net into sf object

Usage

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

Run this code
# NOT RUN {
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"))
# }

Run the code above in your browser using DataLab