To get the most probable route for a small GPS trace, submit the following GPX file
<?xml version="1.0"?>
<gpx version="1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.topografix.com/GPX/1/0"
xsi:schemaLocation="http://www.topografix.com/GPX/1/0 http://www.topografix.com/GPX/1/0/gpx.xsd">
<trk>
<trkseg>
<trkpt lat="51.10177" lon="0.39349"/>
<trkpt lat="51.10181" lon="0.39335"/>
<trkpt lat="51.10255" lon="0.39366"/>
<trkpt lat="51.10398" lon="0.39466"/>
<trkpt lat="51.10501" lon="0.39533"/>
</trkseg>
</trk>
</gpx>
in a POST request. For illustration purposes, the waypoints are shown below in a GET request. For production please use POST requests, because the URL size of GET requests is limited.
https://m.fleet.ls.hereapi.com/2/calculateroute.json
?apiKey={YOUR_API_KEY}
&routeMatch=1
&mode=fastest;car;traffic:disabled
&waypoint0=51.10177,0.39349
&waypoint1=51.10181,0.39335
&waypoint2=51.10255,0.39366
&waypoint3=51.10398,0.39466
&waypoint4=51.10501,0.39533
Note: This example uses a
HERE API Key to authenticate your request. For information on other possible options, see
Authentication Guide. For examples of how to use the other authentication options with the
Fleet Telematics Route Matching, see
Authentication Examples The response to the above request includes a JSON object with the following elements:
- GPS trace points matched on the route in the
waypoint
section - the most probably driven route in the section
leg
with a sequence of link
s - information about illegal, dangerous or unexpected behavior in the
warnings
section
{
"response": {
"route": [
{
"mode": {
"type": "matched",
"transportModes": [
"car"
],
"trafficMode": "disabled"
},
"boatFerry": false,
"railFerry": false,
"waypoint": [
{
"linkId": "+25664478",
"mappedPosition": {
"latitude": 51.10178,
"longitude": 0.3935
},
"originalPosition": {
"latitude": 51.10177,
"longitude": 0.39349
},
"spot": 0.62907,
"confidenceValue": 1,
"elevation": 0,
"headingDegreeNorthClockwise": 10000,
"headingMatched": -66,
"matchDistance": 1.46,
"minError": 1,
"routeLinkSeqNrMatched": 0,
"speedMps": 0,
"timestamp": 0
},
{
"linkId": "+25664478",
"mappedPosition": {
"latitude": 51.10182,
"longitude": 0.39336
},
"originalPosition": {
"latitude": 51.10181,
"longitude": 0.39335
},
"spot": 0.87907,
"confidenceValue": 1,
"elevation": 0,
"headingDegreeNorthClockwise": 10000,
"headingMatched": -66,
"matchDistance": 1.46,
"minError": 1,
"routeLinkSeqNrMatched": 0,
"speedMps": 0,
"timestamp": 0
},
{
"linkId": "+781742855",
"mappedPosition": {
"latitude": 51.10255,
"longitude": 0.39367
},
"originalPosition": {
"latitude": 51.10255,
"longitude": 0.39366
},
"spot": 0,
"confidenceValue": 1,
"elevation": 0,
"headingDegreeNorthClockwise": 10000,
"headingMatched": 22,
"matchDistance": 1.11,
"minError": 1,
"routeLinkSeqNrMatched": 5,
"speedMps": 0,
"timestamp": 0
},
{
"linkId": "+860272609",
"mappedPosition": {
"latitude": 51.10398,
"longitude": 0.39468
},
"originalPosition": {
"latitude": 51.10398,
"longitude": 0.39466
},
"spot": 0.15352,
"confidenceValue": 1,
"elevation": 0,
"headingDegreeNorthClockwise": 10000,
"headingMatched": 25,
"matchDistance": 1.87,
"minError": 1,
"routeLinkSeqNrMatched": 11,
"speedMps": 0,
"timestamp": 0
},
{
"linkId": "+1022687693",
"mappedPosition": {
"latitude": 51.10501,
"longitude": 0.39532
},
"originalPosition": {
"latitude": 51.10501,
"longitude": 0.39533
},
"spot": 0.28475,
"confidenceValue": 1,
"elevation": 0,
"headingDegreeNorthClockwise": 10000,
"headingMatched": 17,
"matchDistance": 1.33,
"minError": 1,
"routeLinkSeqNrMatched": 14,
"speedMps": 0,
"timestamp": 0
}
],
"leg": [
{
"length": 0,
"travelTime": 0,
"link": [
{
"linkId": "25664478",
"length": 43.08,
"remainDistance": 397,
"remainTime": 42,
"shape": [
51.10168,
0.39385,
51.10184,
0.39329
],
"functionalClass": 5,
"confidence": 1,
"offset": 0.62907,
"timezone": 0
},
{
"linkId": "1022687683",
"length": 35.21,
"remainDistance": 381,
"remainTime": 40,
"shape": [
51.10184,
0.39329,
51.10214,
0.39345
],
"functionalClass": 4,
"confidence": 1
},
{
"linkId": "1022687684",
"length": 11.66,
"remainDistance": 346,
"remainTime": 36,
"shape": [
51.10214,
0.39345,
51.10224,
0.3935
],
"functionalClass": 4,
"confidence": 1
},
{
"linkId": "25664459",
"length": 9.33,
"remainDistance": 334,
"remainTime": 35,
"shape": [
51.10224,
0.3935,
51.10232,
0.39354
],
"functionalClass": 4,
"confidence": 1
},
{
"linkId": "781742854",
"length": 27.16,
"remainDistance": 325,
"remainTime": 34,
"shape": [
51.10232,
0.39354,
51.10245,
0.39361,
51.10255,
0.39367
],
"functionalClass": 4,
"confidence": 1
},
{
"linkId": "781742855",
"length": 16.8,
"remainDistance": 298,
"remainTime": 31,
"shape": [
51.10255,
0.39367,
51.10269,
0.39376
],
"functionalClass": 4,
"confidence": 1
},
{
"linkId": "25664450",
"length": 44.74,
"remainDistance": 281,
"remainTime": 31,
"shape": [
51.10269,
0.39376,
51.10292,
0.39391,
51.10306,
0.39401
],
"functionalClass": 4,
"confidence": 1
},
{
"linkId": "25664444",
"length": 21.72,
"remainDistance": 236,
"remainTime": 29,
"shape": [
51.10306,
0.39401,
51.10324,
0.39413
],
"functionalClass": 4,
"confidence": 1
},
{
"linkId": "25664440",
"length": 44.02,
"remainDistance": 214,
"remainTime": 22,
"shape": [
51.10324,
0.39413,
51.10335,
0.3942,
51.1035,
0.39431,
51.1036,
0.39439
],
"functionalClass": 4,
"confidence": 1
},
{
"linkId": "25664427",
"length": 22.3,
"remainDistance": 170,
"remainTime": 18,
"shape": [
51.1036,
0.39439,
51.10369,
0.39446,
51.10378,
0.39453
],
"functionalClass": 4,
"confidence": 1
},
{
"linkId": "860272608",
"length": 19.68,
"remainDistance": 148,
"remainTime": 15,
"shape": [
51.10378,
0.39453,
51.10394,
0.39465
],
"functionalClass": 4,
"confidence": 1
},
{
"linkId": "860272609",
"length": 28.22,
"remainDistance": 128,
"remainTime": 13,
"shape": [
51.10394,
0.39465,
51.10417,
0.39482
],
"functionalClass": 4,
"confidence": 1
},
{
"linkId": "781742870",
"length": 55.33,
"remainDistance": 100,
"remainTime": 13,
"shape": [
51.10417,
0.39482,
51.10427,
0.39489,
51.10439,
0.39497,
51.10452,
0.39505,
51.10463,
0.39512
],
"functionalClass": 4,
"confidence": 1
},
{
"linkId": "1022687692",
"length": 23.55,
"remainDistance": 45,
"remainTime": 10,
"shape": [
51.10463,
0.39512,
51.10483,
0.39523
],
"functionalClass": 4,
"confidence": 1
},
{
"linkId": "1022687693",
"length": 74.44,
"remainDistance": 21,
"remainTime": 2,
"shape": [
51.10483,
0.39523,
51.10547,
0.39554
],
"functionalClass": 4,
"confidence": 1,
"offset": 0.28475
}
],
"trafficTime": 0,
"baseTime": 0
}
],
"summary": {
"travelTime": 42,
"distance": 397,
"baseTime": 42,
"trafficTime": 42,
"flags": []
}
}
],
"warnings": [],
"language": "en-us"
}
}