- Developers
- Sygic Maps API
- Analytics API
- Map matching
Map matching
- Move to section
Please note Sygic does no longer issue new Sygic Maps API keys. This documentation is for existing customers only. If you wish to include maps & navigation into your project, please refer to Sygic Maps SDK.
Overview
Map matching lets you snap sets of GPS points to the road network with very high accuracy.
Live Example
This example demonstrates the use of the Map matching service. Click on icons to see code on Github or play with it in JSFiddle:
Request
API Reference
https://analytics.api.sygic.com/v1/api/matching?key=yourAPIkey
Request authentication is done via parameter key, which must be included in the request URL.
Methods
- POST
Parameters
Required Parameters
To create a valid request, path OR coordinates must be included in the request.
Parameter | Data type | Description |
path | string | Path is a representation of sets of GPS positions using Google polyline encoding utility. This method is more compact than listing all GPS coordinates. Example: "path": "c~ffH}okjBeAmJ" |
coordinates | array of strings | Set of GPS coordinates for map matching. Example: "coordinates": ["48.37362,17.595033","48.37397,17.59686"] |
Optional Parameters
Parameter | Data type | Description |
accuracies | array of decimal values | Set of radiuses of uncertainty for the corresponding locations, measured in meters. This field is not required. When is omitting we will use default values for best results. Example: "accuracies": [9.5,10] |
timestamps | array of integers | Set of timestamps in seconds since midnight, January 1, 1970 UTC. Example: "timestamps":[1464691627,1464691698] |
units | string | Units' format. Default value is "metric". Values: metric, imperial |
The number of accuracies and timestamps must match number of coordinates.
Response
POST
POST https://analytics.api.sygic.com/v1/api/matching?key=yourAPIkey
Content-Type: application/json
Example request body with path:
{
"path": "u{ydH}dogBp@oEj@eSd@eQCqC}QeJw@sAAqANwGq@mFiFi]aFg^m@eD`AALM^kB",
"accuracies": [9,9,10,10,9,10,9,10,11,11,9,10,10,9,9,11]
}
Example request body with coordinates:
{
"coordinates": [
"48.14283,17.12223",
"48.14258,17.12327",
"48.14236,17.12650",
"48.14217,17.12941",
"48.14219,17.13014",
"48.14522,17.13193",
"48.14550,17.13235",
"48.14551,17.13276",
"48.14543,17.13416",
"48.14568,17.13535",
"48.14685,17.14020",
"48.14798,17.14520",
"48.14821,17.14603",
"48.14788,17.14604",
"48.14781,17.14611",
"48.14765,17.14665"
],
"accuracies": [9,9,10,10,9,10,9,10,11,11,9,10,10,9,9,11]
}
Both of the above requests produce the same result.
Response Body
{
"route": "s{ydH{dogB@EDQPw@Hs@XwGFmABsALgFNyEFqBH{C@mAB}A@qA@k@YOIEo@]cAg@oL_GIEi@c@a@aBBi@JmCC{CI}@DSOyAOu@Yo@G_@Ga@]{BKm@s@aFIg@My@i@kDo@mE_@_Ce@gD]{BEW_@uB[oBM{@CU_AaHSwAhAKJ]ZmA",
"status": "OK",
"distance": {
"value": 2130,
"text": "2.13 km"
},
"copyright": "© 2018 Sygic a.s."
}
- Next article: Speeding report