N-Ways
Documentação para programadoresTrânsito

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

NomeOndeTipoDescrição
bboxconsultastringObrigató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

CampoTipoDescrição
typestringObrigatório.
featuresobject[]Obrigatório.
features[].typestringObrigatório.
features[].geometryLineStringObrigatório.
features[].geometry.typestringObrigatório.
features[].geometry.coordinatesnumber[][]Obrigatório.
features[].propertiesobjectObrigatório.
features[].properties.levelintegerObrigatório. ≥ 0, ≤ 3.
features[].properties.levelNamestringObrigatório. Um de: free, slow, heavy, standstill.
features[].properties.speedKmhnumberObrigatório.
features[].properties.normalKmhnumberObrigatório.
features[].properties.confidencestringObrigatório. Um de: low, medium, high.
attributionstringObrigató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

  • default Erro