Speed limits
The API gives returns the speed limit for the closest road segment to given coordinates. Additionally, returns also the street or road name and the surface value.
API URL
The request URL should match the following pattern:
https://api.kartes.lv/v3//speed_limit?
The response is given in the JSON.
The HTTP GET request method is used.
- klienta_atslega: Your authorisation key.
Query parameters
There are three ways to define coordinates:
Parameter | Description |
---|---|
lat | Latitude coordinate in the WGS-84 projection (EPSG:4326) |
lon | Longitude coordinate in the WGS-84 projection (EPSG:4326) |
x | x-coordinate in the TM Baltic93 CRS (EPSG:25884). |
y | y-coordinate in the TM Baltic93 CRS (EPSG:25884). |
p | Array of coordinate pairs (e.g., [[510427,6308643],[514276,6304829]]). |
wgs84 | Should be used in case of p parameter, if the WGS coordinates are used. |
Error codes
Status code | Description |
---|---|
200 | Missing input data. |
200 | Wrong input data format. |
404 | No location found. The URL is not recognized; the resource does not exist. |
5xx | Server error. |
Response parameters
The response consists of an array of objects, each of them having two elements. Each element consists of following parameters:
Parameter | Description |
---|---|
name | Street or road name |
populated_place | Populated place (city, town or other settlement; only for named streets) |
teritorial_unit | Territorial unit (only for named streets) |
administrative_unit | Administrative unit (only for named streets) |
surface | Surface |
speed_limit | Speed limit |
is_populated_place | Is this a populated place? |
distance | Distance to the closest road segment |
Examples
Input (array of coordinate pairs, TM Baltic93):
https://api.kartes.lv/v3//speed_limit?p=[[510427,6308643],[514276,6304829]]
Response:
[
[
{
"name": "Maskavas iela",
"populated_place": "Rīga",
"teritotial_unit": null,
"administrative_unit": "Rīgas pilsēta",
"surface": "paved",
"speed_limit": "50",
"is_populated_place": "1",
"distance": 0.43
},
{
"name": null,
"populated_place": null,
"teritotial_unit": null,
"administrative_unit": null,
"surface": "paved",
"speed_limit": "20",
"is_populated_place": "1",
"distance": 32.28
}
],
[
{
"name": "Maskavas iela",
"populated_place": "Rīga",
"teritotial_unit": null,
"administrative_unit": "Rīgas pilsēta",
"surface": "paved",
"speed_limit": "50",
"is_populated_place": "1",
"distance": 4.53
},
{
"name": null,
"populated_place": null,
"teritotial_unit": null,
"administrative_unit": null,
"surface": "gravel",
"speed_limit": "50",
"is_populated_place": "1",
"distance": 42.3
}
]
]
Input (coordinate pair, TM Baltic93):
https://api.kartes.lv/v3/speed_limit?lat=56.913149&lon=24.189405
Response:
[
{
"name": "Prūšu iela",
"populated_place": "Rīga",
"teritotial_unit": "",
"administrative_unit": "Rīgas pilsēta",
"surface": "paved",
"speed_limit": 50,
"is_populated_place": 0,
"distance": 0.93
},
{
"name": "",
"populated_place": "",
"teritotial_unit": "",
"administrative_unit": "",
"surface": "paved",
"speed_limit": 20,
"is_populated_place": 0,
"distance": 1.59
}
]
Input (coordinate pair, WGS-84):
https://api.kartes.lv/v3//speed_limit?p=[[56.929432,24.171330]]&wgs84
Response:
[
[
{
"name": "Rītupes iela",
"populated_place": "Rīga",
"teritotial_unit": "",
"administrative_unit": "Rīgas pilsēta",
"surface": "paved",
"speed_limit": 50,
"is_populated_place": 0,
"distance": 10.38
},
{
"name": "Salaspils iela",
"populated_place": "Rīga",
"teritotial_unit": "",
"administrative_unit": "Rīgas pilsēta",
"surface": "paved",
"speed_limit": 50,
"is_populated_place": 0,
"distance": 42.25
}
]
]