Snap to Roads and Speeding Report
Adjust historical vehicle GPS tracking to the road (map matching).
Overview
The Snap to Road API adjusts historical vehicle GPS tracks to match roads accurately. It also provides a speeding report. The service is available via HTTP-JSON/XML.
Web Service Details
URL base service:
- HTTP requests in GET or POST
- Response in JSON / XML format
Get a Route Polyline from a GPS Track (Snap to Roads) and Speeding Report
Request Example
https://lb.cercalia.com/services/json?cmd=geomtrack&mode=regular&TRACK=[2.825850,41.969279@0,45@@70@@@A],[2.822355,41.965995@0,45@@10@@@A],[2.828963,41.968589@0,45@@10@@@B],[2.828278,41.965013@0,45@@10@@@B]&SPEEDING=true&SPEEDTOLERANCE=10&SRS=EPSG:4326&key=YOUR_API_KEY
Request Parameters
Parameter | Description |
---|---|
track | List of ordered points, separated by commas (max 5,000 points). Each point follows the format [coord{@<compass>}{@@speed}{@@@attribute}] . |
srs | Coordinate system of the points list. Use EPSG:4326 for geographic coordinates. |
weight | Route type (default: distance ). |
net | Optional: Specifies the country net used. |
geometrysrs | Coordinate system of the resulting polyline. Defaults to the same as srs . Example: EPSG:4326 . |
geometrytolerance | Geometry tolerance (simplification) in meters. |
points | If true , returns the original GPS track points displaced on the road route. |
speeding | Boolean. If true , returns separate route sections based on speed compliance. |
speedtolerance | Speed tolerance in km/h. Speeding is considered only if the vehicle exceeds the limit by more than this value (default: 0 ). |
Low-Level Control Parameters
Parameter | Description |
---|---|
onlytrack | If true , returns a multipoint geometry with the route points. Default: false . |
maxdirectionsearchdistance | Maximum allowable deviation (in meters) between a GPS point and a road point, considering direction. Default: 10 . |
maxsearchdistance | Maximum allowable deviation (in meters) between a GPS point and a road point, ignoring direction. Default: 20 . |
factor | Factor between route distance and straight-line distance. If exceeded, the route is ignored in favor of a straight line. Default: 2 . |
Response Example
{
"cercalia": {
"cmd": "geomtrack",
"version": "1",
"track": {
"geometry": [
{
"attribute": "A",
"distance": "0.97",
"speeding": "true",
"wkt": {
"$valor": "LINESTRING (2.825862 41.96928, 2.825857 41.969292, 2.825804 41.969421, 2.825552 41.970058, 2.824968 41.970032, 2.82469 41.970032, 2.824195 41.970066, 2.823971 41.970093, 2.823935 41.96957, 2.823845 41.96899, 2.823737 41.968475, 2.823549 41.96788, 2.823468 41.967857, 2.823414 41.967827, 2.823387 41.967777, 2.823369 41.967716, 2.823387 41.967651, 2.82345 41.967598, 2.823333 41.967449, 2.823127 41.967216, 2.823001 41.96711, 2.822551 41.966805, 2.822363 41.966705, 2.821779 41.966446, 2.821671 41.966412, 2.821563 41.966377, 2.821033 41.966251, 2.82098 41.966282, 2.82089 41.966305, 2.8208 41.966297, 2.820737 41.966255, 2.82071 41.966225, 2.82071 41.96611, 2.820746 41.966068, 2.820773 41.966034, 2.820872 41.966022, 2.820971 41.966042, 2.821051 41.966137, 2.82168 41.966305, 2.822057 41.966164, 2.822392 41.966072)"
}
},
{
"attribute": "A",
"distance": "0.77",
"speeding": "false",
"wkt": {
"$valor": "LINESTRING (2.822392 41.966072, 2.822749 41.965977, 2.822848 41.965935, 2.823001 41.966183, 2.823144 41.966518, 2.823387 41.967094, 2.823495 41.96743, 2.823585 41.967598, 2.823684 41.967651, 2.82371 41.967724, 2.823701 41.967785, 2.823647 41.967838, 2.823863 41.968437, 2.824528 41.968376, 2.824815 41.968376, 2.825013 41.968403, 2.825444 41.968464, 2.826145 41.968555, 2.826998 41.968716, 2.82769 41.96875, 2.827977 41.968819, 2.828049 41.968819, 2.828121 41.968811, 2.828229 41.968796, 2.828373 41.968739, 2.828525 41.968689, 2.828687 41.968636, 2.828948 41.968616, 2.828942 41.96859)"
}
},
{
"attribute": "B",
"distance": "0.59",
"speeding": "false",
"wkt": {
"$valor": "LINESTRING (2.828942 41.96859, 2.82893 41.968529, 2.829244 41.967705, 2.829478 41.966846, 2.829487 41.96674, 2.829918 41.96661, 2.829702 41.966316, 2.829657 41.966217, 2.829495 41.965553, 2.82946 41.96534, 2.829468 41.965256, 2.829504 41.965149, 2.829639 41.964951, 2.829468 41.96487, 2.829136 41.96476, 2.829082 41.964802, 2.828992 41.964821, 2.828948 41.964813, 2.828894 41.964787, 2.82884 41.964733, 2.828822 41.964653, 2.828705 41.96468, 2.828579 41.964733, 2.828204 41.964939)"
}
}
]
},
"server": {
"$valor": "ws.cercalia.com"
},
"instance": {
"$valor": "http://cercalia-lbs-both-lines"
}
}
}
Response Parameters
Parameter | Description |
---|---|
geomtrack | Route polyline in WKT format (LINESTRING /MULTILINESTRING ). |
speeding | true : Speeding occurred in this road section. false : No speeding occurred. |
speedinglevel | Reports the speeding zone if speeding=true . Links to the &SPEEDING= parameter value. |
distance | Provides the distance of each track in meters. Helps generate statistics for sections, including speeding differentiation. |
Visualization
The resulting polyline can be visualized as follows: