This is a static archive of our old OpenStreetMap Help Site. Please post any new questions and answers at community.osm.org.

Overpass Turbo: how to get public transport routes and stops with stop names?

0

I am searching metro and tram routes and stops, example Bilbao.

With overpass turbo wizard on https://overpass-turbo.eu , I use

type=route and route=tram or type=route and route=subway

to create

/*
This has been generated by the overpass-turbo wizard.
The original search was: 
“type=route and route=tram or type=route and route=subway” 
*/
[out:json][timeout:25];
// gather results
(
  // query part for: “type=route and route=tram”
  node["type"="route"]["route"="tram"]({{bbox}});
  way["type"="route"]["route"="tram"]({{bbox}});
  relation["type"="route"]["route"="tram"]({{bbox}});
  // query part for: “type=route and route=subway”
  node["type"="route"]["route"="subway"]({{bbox}});
  way["type"="route"]["route"="subway"]({{bbox}});
  relation["type"="route"]["route"="subway"]({{bbox}});
);
// print results
out meta;
>;
out skel qt;

(I changed to "out meta" to get maximum results)

The example is from Bilbao.

I export to geojson, which gives me almost what I need except on thing:

this is how a tram stop looks like:

{
  "type": "Feature",
  "properties": {
    "@id": "node/5478168779",
    "@relations": [
      {
        "role": "stop",
        "rel": 8753521,
        "reltags": {
          "colour": "green",
          "from": "Bolueta",
          "name": "T1 (Bolueta → La Casilla)",
          "network": "Euskotren Tranbia",
          "network:wikidata": "Q123955",
          "network:wikipedia": "eu:Euskotren Tranbia",
          "operator": "Euskotren",
          "operator:wikidata": "Q3061020",
          "operator:wikipedia": "eu:Eusko Trenbideak",
          "public_transport:version": "2",
          "ref": "T1",
          "route": "tram",
          "to": "La Casilla",
          "type": "route",
          "wheelchair": "yes",
          "wikidata": "Q2661356",
          "wikipedia": "en:Bilbao tram"
        }
      }
    ]
  },
  "geometry": {
    "type": "Point",
    "coordinates": [
      -2.9287285,
      43.2663144
    ]
  },
  "id": "node/5478168779"
},

This is how the stop looks in OpenStreetMap:

alt text

(original data source: https://www.openstreetmap.org/node/5478168779 )

OSM has tags, especially the name, that are missing in the geojson export.

How do I get the tags like

name: "Uribitarte"
network: "Euskotren Tranbia"
operator: "Eusko Trenbideak"
Into the geojson export?

asked 21 Jun '22, 20:02

Gerd_c's gravatar image

Gerd_c
9112
accept rate: 0%


One Answer:

1

Try removing the skel option.

Routes should only be in relations so I shrunk the verbose routine to this:

[bbox:{{bbox}}];
(
  rel[type=route][route=tram];
  rel[type=route][route=subway];
);
out meta;
>;
out qt;

https://wiki.openstreetmap.org/wiki/Overpass_API/Language_Guide#Concise_(skeleton,_skel)

answered 21 Jun '22, 22:52

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

Source code available on GitHub .