NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

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%


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)

permanent link

answered 21 Jun '22, 22:52

DaveF's gravatar image

DaveF
3.3k8498133
accept rate: 16%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×228
×179
×13
×11
×10

question asked: 21 Jun '22, 20:02

question was seen: 2,950 times

last updated: 21 Jun '22, 22:52

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum