Trânsito
O congestionamento nas estradas em direto, em GeoJSON.
Nota:
Envie a sua chave com key=A_SUA_CHAVE_API no endereço, ou no cabeçalho X-NWays-Api-Key. Chaves de API
Endereço base: https://nways.ng/maps/v1
Trânsito em direto numa zona
GET https://nways.ng/maps/v1/traffic
Estradas com leituras em direto dos telemóveis N-Ways (anonimizadas), como linhas GeoJSON com um nível de congestionamento. Motivos: BBOX_INVALID.
Parâmetros
| Nome | Onde | Tipo | Descrição |
|---|---|---|---|
bbox | consulta | string | Obrigatório. minLng,minLat,maxLng,maxLat, com menos de 3° de largura. |
cURL
curl "https://nways.ng/maps/v1/traffic?bbox=3.30%2C6.40%2C3.50%2C6.60" \
-H "X-NWays-Api-Key: A_SUA_CHAVE_API"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()Resposta
Trânsito
| Campo | Tipo | Descrição |
|---|---|---|
type | string | Obrigatório. |
features | object[] | Obrigatório. |
features[].type | string | Obrigatório. |
features[].geometry | LineString | Obrigatório. |
features[].geometry.type | string | Obrigatório. |
features[].geometry.coordinates | number[][] | Obrigatório. |
features[].properties | object | Obrigatório. |
features[].properties.level | integer | Obrigatório. ≥ 0, ≤ 3. |
features[].properties.levelName | string | Obrigatório. Um de: free, slow, heavy, standstill. |
features[].properties.speedKmh | number | Obrigatório. |
features[].properties.normalKmh | number | Obrigatório. |
features[].properties.confidence | string | Obrigatório. Um de: low, medium, high. |
attribution | string | Obrigatório. |
200 OK
{
"type": "string",
"features": [
{
"type": "string",
"geometry": {
"type": "string",
"coordinates": [
[]
]
},
"properties": {
"level": 0,
"levelName": "free",
"speedKmh": 0,
"normalKmh": 0,
"confidence": "low"
}
}
],
"attribution": "string"
}Erros
defaultErro