inst/doc/traffic.R

## ---- include = FALSE---------------------------------------------------------
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(hereR)

if (requireNamespace("mapview", quietly = TRUE)) {
  mapview::mapviewOptions(
    fgb = FALSE,
    vector.palette = colorRampPalette(c("#FFD700", "#CA0020"))
  )
}

flows <- hereR:::example$flow
incidents <- hereR:::example$incident

## ----flow, eval=FALSE---------------------------------------------------------
#  flows <- flow(
#    aoi = aoi[1, ]
#  )

## ----map_flow, eval=FALSE, out.width='100%'-----------------------------------
#  flows <- flows[order(flows$jam_factor), ]
#  rownames(flows) <- NULL
#  
#  if (requireNamespace("mapview", quietly = TRUE)) {
#    mapview::mapview(flows,
#      zcol = "jam_factor",
#      layer.name = "Jam factor",
#      map.types = c("Esri.WorldTopoMap"),
#      homebutton = FALSE
#    )
#  }

## ----incidents, eval=FALSE----------------------------------------------------
#  incidents <- incident(
#    aoi = aoi[1, ]
#  )

## ----map_incidents, eval=FALSE, out.width='100%'------------------------------
#  if (requireNamespace("mapview", quietly = TRUE)) {
#    mapview::mapview(incidents,
#      zcol = "type",
#      layer.name = "Incident type",
#      map.types = c("Esri.WorldTopoMap"),
#      homebutton = FALSE
#    )
#  }

Try the hereR package in your browser

Any scripts or data that you put into this service are public.

hereR documentation built on Sept. 18, 2023, 5:21 p.m.