Map Matching API¶
Match or Route — which one do you need?
Match takes a list of GPS points a vehicle has already driven and snaps them onto the road network, recovering the true road-level route. Use it for trip reconstruction, mileage auditing and toll reconciliation after the fact.
If you only need a route to be driven — including for truck and container, with weight limits and toll_cost per station — that is Route v4. Route v4 already returns toll data, so you do not need Match for pricing a planned trip.
Get a list of GPS coordinates from a mobile device or a vehicle tracking device that has moved (lat, long). This GPS list is calculated by the Map Matching API to give the route that best matches the actual route data and the list of toll stations, the amount corresponding to the type of vehicle in the input parameters.
URL¶
Method¶
POST
Parameters¶
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
| apikey | array string | yes | none | API key provided by VIETMAP for your account. Register here |
| vehicle | number | no | 1 |
|
Example
URL:
https://maps.vietmap.vn/api/match-tolls?apikey=”your-apikey”&vehicle={vehicle}
body:
[
[
106.757849,
10.817956
],
[
106.759134,
10.821371
],
[
106.760694,
10.825196
]
]
curl --location 'https://maps.vietmap.vn/api/match-tolls?apikey=YOUR_API_KEY_HERE&vehicle=4' \
--header 'Content-Type: application/json' \
--data '[
[
106.757849,
10.817956
],
[
106.759134,
10.821371
],
[
106.760694,
10.825196
]
]'
{
"distance": 0.9228444301945045,
"tolls": [
{
"id": 441,
"name": "Trạm Thu Phí Xa Lộ Hà Nội",
"address": "Xa Lộ Hà Nội",
"type": "",
"price": 108000,
"prices": null
}
],
"path": [
[
106.75796704230189,
10.817930472210803
],
[
106.75817,
10.8188359
],
[
106.758363,
10.8199419
],
[
106.758492,
10.8201079
],
[
106.758639,
10.8208459
],
[
106.75879776283638,
10.821455484269388
],
[
106.758932,
10.8219709
],
[
106.759162,
10.8226259
],
[
106.7593279,
10.823036
],
[
106.7591469,
10.8230179
],
[
106.759248,
10.8232789
],
[
106.7593799,
10.8237109
],
[
106.759499,
10.8239979
],
[
106.759692,
10.824369
],
[
106.7598349,
10.824291
],
[
106.760204,
10.8249049
],
[
106.76043843313977,
10.825331492152502
]
],
}
Response description¶
| Parameter | Type | Description |
|---|---|---|
| path | array | Array containing coordinate pairs along the route |
| distance | float | Total distance of the route (in kilometers) |
| tolls | array | Array containing toll booth information along the route |
For the path array:
| Sub-Parameter | Type | Description |
|---|---|---|
| [longitude, latitude] | array of floats | Coordinate pair representing a point on the route |
For the tolls array:
| Sub-Parameter | Type | Description |
|---|---|---|
| id | integer | Unique identifier for the toll booth |
| name | string | Name of the toll booth |
| address | string | Address of the toll booth |
| type | string | Type of toll booth (entry, exit, etc.) |
| price | integer | Toll price in local currency |
| prices | null | Additional price information (if available) |
