Road kilometre API
The API returns location and additional information about the given kilometre of the specific Latvian state road.
API URL
The request URL should match the following pattern:
https://api.kartes.lv/v3//roadkm?
The response is given in JSON.
The HTTP GET request method is used.
Query parameters
The request consists of the following GET parameters:
Parameter | Description |
---|---|
km | Road kilometre (float) |
index | Road number |
x | x-coordinate |
y | y-coordinate |
d | Error margin in metres (default value — 10 m) |
Response parameters
The response consists of an GeoJSON arrway, where each object properties consist of the following parameters:
Parameter | Description |
---|---|
km | Road kilometre (float) |
index | Road number |
Error codes
Status code | Description |
---|---|
404 | No location found. The URL is not recognized; the resource does not exist. |
5xx | Server error. |
Examples
Input:
https://api.kartes.lv/v3//roadkm?km=15.5&index=A1
Response:
{
"type": "FeatureCollection",
"name": "Road KM",
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:EPSG::3857"
}
},
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"coordinates": [
2709418,
7789529
]
},
"properties": {
"km": "15.50",
"index": "A1"
}
}
]
}
Input:
https://api.kartes.lv/v3//roadkm?x=2684086.2482303474&y=7713776.474187665&d=100
Response:
{
"type": "FeatureCollection",
"name": "Road KM",
"crs": {
"type": "name",
"properties": {
"name": "urn:ogc:def:crs:EPSG::3857"
}
},
"features": [
{
"type": "Feature",
"geometry": {
"type": "Point",
"crs": {
"type": "name",
"properties": {
"name": "EPSG:3857"
}
},
"coordinates": [
2684067,
7713870
]
},
"properties": {
"km": "7.69",
"index": "V7",
"distance": "16972.592676429493"
}
}
]
}