Skip to content

Transport by zone

GET /contesto/trasporti_zona

Nearest transport hubs to the point, whatever their distance. Unlike Transport it is not bound to a radius, and it also covers airports, ports and motorway exits.

Example Request

curl --location 'https://sandbox-context.realitycs.it/contesto/trasporti_zona?latitudine=45.464664&longitudine=9.188540' \
--header 'Authorization: Bearer <token>'

Request Fields

Field Required Default Description Type Example Notes
latitudine yes Latitude of the point number 45.464664
longitudine yes Longitude of the point number 9.188540

raggio is accepted but ignored

Passing raggio does not fail, and it does not change the response either: the same call with raggio=50 and with raggio=250 returns byte for byte the same payload. Do not use this endpoint expecting to limit the search area, use Transport for that.

JSON keys in the response:

trasporti_zona holds seven categories: bus_fermata, metro_fermata, tram_fermata, stazione, aeroporto, porto and casello_autostradale.

Every entry has the same shape:

  • nome: Name of the hub, in capitals.
  • distanza: Distance from the requested point, in metres.
  • geojson: Geometry of the hub, as a GeoJSON Point with coordinates ordered longitude first.

How many results come back

The number of entries is capped per category, and the cap differs: bus_fermata, metro_fermata and tram_fermata return up to 10, while stazione, aeroporto, porto and casello_autostradale return up to 3. Results are ordered by increasing distance, so the first entry is always the nearest.

Distances can be large

Since there is no radius, the nearest hub is returned however far it is. In the example below, taken from the centre of Milan, the nearest airport is over 6 km away and the nearest port over 10 km. Always display distanza alongside the name: a port a city away is not a feature of the neighbourhood.

Three categories exist only here

aeroporto, porto and casello_autostradale are never returned by Transport, which is capped at one kilometre and would almost never reach them.

Example Response

Note

Each category is truncated to one entry in the example below, the actual response returns up to 10 or 3 per category as described above.

{
  "contesto": {
    "trasporti_zona": {
      "aeroporto": [
        {
          "nome": "ENRICO FORLANINI",
          "distanza": 6653,
          "geojson": {
            "coordinates": [
              9.272693008,
              45.455792007
            ],
            "type": "Point"
          }
        }
      ],
      "porto": [
        {
          "nome": "APPRODO",
          "distanza": 10650,
          "geojson": {
            "coordinates": [
              9.0695831,
              45.4180145
            ],
            "type": "Point"
          }
        }
      ],
      "bus_fermata": [
        {
          "nome": "DUOMO M1 M3",
          "distanza": 95,
          "geojson": {
            "coordinates": [
              9.187443029,
              45.464290105
            ],
            "type": "Point"
          }
        }
      ],
      "metro_fermata": [
        {
          "nome": "DUOMO M1 M1",
          "distanza": 83,
          "geojson": {
            "coordinates": [
              9.189596064,
              45.464622056
            ],
            "type": "Point"
          }
        }
      ],
      "tram_fermata": [
        {
          "nome": "DUOMO M1 M3",
          "distanza": 94,
          "geojson": {
            "coordinates": [
              9.187987058,
              45.463912089
            ],
            "type": "Point"
          }
        }
      ],
      "stazione": [
        {
          "nome": "MILANO CADORNA",
          "distanza": 1092,
          "geojson": {
            "coordinates": [
              9.175596,
              45.468359
            ],
            "type": "Point"
          }
        }
      ],
      "casello_autostradale": [
        {
          "nome": "A7 | FAMAGOSTA PARCHEGGIO M2",
          "distanza": 4173,
          "geojson": {
            "coordinates": [
              9.165431,
              45.4308086
            ],
            "type": "Point"
          }
        }
      ]
    }
  }
}