Use Route Matching API to determine if a location is on a public or private road
Use Route Matching API to determine if a location is on a public or private road
Use case: Customer would like to measure if their vehicle is driving on a public road. This becomes the question how customer can determine if a given location is on a public road or not.
The Route Matching API v8 can support this use case. It computes the most probable route from a GPS trace, and meanwhile, with parameter "&attributes= " it can request additional attributes - including the "PRIVATE" attribute - of the matched route links.
In this case, the trace for Route Matching API has only one pair of coordinates. As a POST method request, below csv example with lat/lon is passed as the request "Body".
latitude,longitude
-37.83537557488685,144.90697748596094
Then add parameter "&attributes=LINK_ATTRIBUTE_FCn(PRIVATE)" to request the "PRIVATE" attribute of "LINK_ATTRIBUTE_FCn" layer. So the request will be:
https://routematching.hereapi.com/v8/match/routelinks?filetype=CSV&apiKey={{apiKey}}&attributes=LINK_ATTRIBUTE_FCn(PRIVATE)&mode=fastest;car&routeMatch=1
In the response, it will return matched link and the PRIVATE attribute. If the value of "PRIVATE" attribute is "Y", then it's a private road; otherwise a public road. For example:
{
"response": {
"route": [
{
"waypoint": [
{
"linkId": "-1376527051",
"mappedPosition": {
"latitude": -37.83537,
"longitude": 144.90696
},
"originalPosition": {
"latitude": -37.83537557488685,
"longitude": 144.90697748596094
},
"spot": 0.75977,
"confidenceValue": 1.0,
"elevation": 0.0,
"headingDegreeNorthClockwise": 10000.0,
"headingMatched": -171.0,
"matchDistance": 2.04,
"minError": 2.0,
"routeLinkSeqNrMatched": 0,
"speedMps": 0.0,
"timestamp": 0
}
],
"mode": {
"type": "matched",
"transportModes": [
"car"
],
"trafficMode": "disabled"
},
"leg": [
{
"length": 0,
"travelTime": 0,
"link": [
{
"linkId": "-1376527051",
"length": 160.05,
"remainDistance": 0,
"remainTime": 0,
"shape": [
-37.83537,
144.90696,
-37.83547,
144.90694,
-37.83558,
144.90692,
-37.83573,
144.9069,
-37.83637,
144.90685,
-37.83681,
144.90682
],
"functionalClass": 5,
"confidence": 1.0,
"attributes": {
"LINK_ATTRIBUTE_FCN": [
{
"PRIVATE": "Y"
}
]
},
"segmentRef": "$0:22820610:$1:900587824#-0..1"
}
],
"trafficTime": 0,
"baseTime": 0,
"refReplacements": {
"0": "hrn:here:data::olp-here:rib-2:7390:",
"1": "here:cm:segment"
}
}
],
"summary": {
"travelTime": 0,
"distance": 0,
"baseTime": 0,
"trafficTime": 0,
"flags": []
},
"boatFerry": false,
"railFerry": false
}
],
"warnings": [],
"language": "en-us"
}
}
Online docs for further reference are available here:
https://www.here.com/docs/bundle/route-matching-api-developer-guide/page/topics/here-map-content.html
https://www.here.com/docs/bundle/route-matching-api-v8-api-reference/page/index.html#tag/Route-Matching-V8/operation/matchRouteV8compatibilityToV2GET