Traffic
Live congestion on the roads, as GeoJSON.
Note:
Send your key as key=YOUR_API_KEY on the address, or in the X-NWays-Api-Key header. API keys
Base address: https://nways.ng/maps/v1
Live traffic in an area
GET https://nways.ng/maps/v1/traffic
Roads with live readings from N-Ways' phones (anonymised), as GeoJSON lines with a congestion level. Reasons: BBOX_INVALID.
Parameters
| Name | In | Type | Description |
|---|---|---|---|
bbox | query | string | Required. minLng,minLat,maxLng,maxLat, under 3° across. |
cURL
curl "https://nways.ng/maps/v1/traffic?bbox=3.30%2C6.40%2C3.50%2C6.60" \
-H "X-NWays-Api-Key: YOUR_API_KEY"JavaScript
const res = await fetch('https://nways.ng/maps/v1/traffic?bbox=3.30%2C6.40%2C3.50%2C6.60', {
headers: { 'X-NWays-Api-Key': process.env.NWAYS_API_KEY },
})
const data = await res.json()Python
import os
import requests
res = requests.get(
"https://nways.ng/maps/v1/traffic?bbox=3.30%2C6.40%2C3.50%2C6.60",
headers={"X-NWays-Api-Key": os.environ["NWAYS_API_KEY"]},
timeout=10,
)
data = res.json()Response
Traffic
| Field | Type | Description |
|---|---|---|
type | string | Required. |
features | object[] | Required. |
features[].type | string | Required. |
features[].geometry | LineString | Required. |
features[].geometry.type | string | Required. |
features[].geometry.coordinates | number[][] | Required. |
features[].properties | object | Required. |
features[].properties.level | integer | Required. ≥ 0, ≤ 3. |
features[].properties.levelName | string | Required. One of: free, slow, heavy, standstill. |
features[].properties.speedKmh | number | Required. |
features[].properties.normalKmh | number | Required. |
features[].properties.confidence | string | Required. One of: low, medium, high. |
attribution | string | Required. |
200 OK
{
"type": "string",
"features": [
{
"type": "string",
"geometry": {
"type": "string",
"coordinates": [
[]
]
},
"properties": {
"level": 0,
"levelName": "free",
"speedKmh": 0,
"normalKmh": 0,
"confidence": "low"
}
}
],
"attribution": "string"
}Errors
defaultError