Real-time traffic flow from the HERE 'Traffic' API in areas of interest (AOIs).
The traffic flow data contains speed ("SP"
) and congestion (jam factor: "JF"
) information,
which corresponds to the status of the traffic at the time of the query.
flow(aoi, min_jam_factor = 0, url_only = FALSE)
aoi |
|
---|---|
min_jam_factor | numeric, only retrieve flow information with a jam factor greater than the value provided ( |
url_only | boolean, only return the generated URLs ( |
An sf
object containing the requested traffic flow information.
The maximum width and height of the bounding box of the input AOIs is 10 degrees.
This means that each polygon (= one row) in the AOI sf
object should fit in a 10 x 10 degree bbox.
Explanation of the traffic flow variables:
"PC"
: Point TMC location code.
"DE"
: Text description of the road.
"QD"
: Queuing direction. '+' or '-'. Note this is the opposite of the travel direction in the fully qualified ID, For example for location 107+03021 the QD would be '-'.
"LE"
: Length of the stretch of road.
"TY"
: Type information for the given Location Referencing container. This may be a freely defined string.
"SP"
: Speed (based on UNITS) capped by speed limit.
"FF"
: The free flow speed on this stretch of the road.
"JF"
: The number between 0.0 and 10.0 indicating the expected quality of travel. When there is a road closure, the Jam Factor will be 10. As the number approaches 10.0 the quality of travel is getting worse. -1.0 indicates that a Jam Factor could not be calculated.
"CN"
: Confidence, an indication of how the speed was determined. -1.0 road closed. 1.0=100%.
# Provide an API Key for a HERE project set_key("<YOUR API KEY>") # Real-time traffic flow flow <- flow( aoi = aoi[aoi$code == "LI", ], url_only = TRUE )