Movatterモバイル変換


[0]ホーム

URL:


Traffic API

Real-time traffic flow and incident information based on the ‘HERETraffic’ API. The traffic flow data contains speed ("SP")and congestion (jam factor:"JF") information. Trafficincidents contain information about location, time, duration, severity,description and other details.

Flow

In order to request the traffic flow, areas of interest (AOIs) haveto be provided. The AOIs must be ansf object containing apolygon or multiple polygons. The response from the HERE Traffic APIwill be spatially joined on the AOIs and thereby the traffic flows aremapped to the corresponding polygon.

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

Print the (ordered) ‘jam factor’ of the traffic flow on aninteractive leaflet map:

flows<- flows[order(flows$jam_factor), ]rownames(flows)<-NULLif (requireNamespace("mapview",quietly =TRUE)) {  mapview::mapview(flows,zcol ="jam_factor",layer.name ="Jam factor",map.types =c("Esri.WorldTopoMap"),homebutton =FALSE  )}

Incidents

AOIs also must be provided in order to request information abouttraffic incidents in specific regions. The time interval, which definesthe traffic incidents that should be considered, can be specitified bythefrom andto parameter. The datetimeinformation passed to the function must be a timestamp of typePOSIXct. By default, no time interval filter is set.

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

Print the traffic incidents on an interactive leaflet map:

if (requireNamespace("mapview",quietly =TRUE)) {  mapview::mapview(incidents,zcol ="type",layer.name ="Incident type",map.types =c("Esri.WorldTopoMap"),homebutton =FALSE  )}

API Reference


[8]ページ先頭

©2009-2025 Movatter.jp