[OverpassTurbo] How to retrieve train line including station names?

Hello

Using OverpassTurbo, I’d like to query OSM to 1) retrieve a whole train line, with all its stations, and 2) have the station names displayed when I either click on them or just move the mouse over.

I know very little about OverpassTurbo, and don’t know how to go about writing the right query to achieve this.

Does someone know?

For instance, how should I query OSM to retrieve the whole Acela Express line, including all its stops?
https://en.wikipedia.org/wiki/Acela_Express

Thank you.

To dvelop such a query, I recommend to learn something about the tagging of OSM elements.

You are familiar with things like http://wiki.openstreetmap.org/wiki/Elements

and http://wiki.openstreetmap.org/wiki/Map_Features ?

Then in detail, see http://wiki.openstreetmap.org/wiki/Railways
http://wiki.openstreetmap.org/wiki/Railway_stations and http://wiki.openstreetmap.org/wiki/Tag:route%3Drailway

With those information you should be able to define the data elements you need in general,

and THEN you can try to create queries in overpass-turbo to get your data.

Maybe when you have a first query, you can post it here and discuss the result … and then we can do more finetuning.

Thanks but I don’t know what to do with the above.

No experts here know the answer?

Overpass searches for elements in OSM. Stefan named the relevant ones.
Reading this and some Overpass introduction will help you to write your first queries.

Search the internet, try yourself, develop step by step and the people here will help you.
Maybe this article can give you some hints: http://forum.openstreetmap.org/viewtopic.php?pid=583581#p583581

Thanks.

It’s quite above my head, but the following works:


[out:json][timeout:25];

(
relation["route"="bus"] ({{bbox}});
);

out body;
>;
out skel qt;

This does download a bus route in the area that was displayed in OverpassTurbo, but…

  1. It’s missing the stations, each with its name: I guess I should add “node” somewhere
  2. I’d like to change the way the route is displayed, ie. hide the circles, make the route thinner, in a different color, etc.

Are there no other tutorials than those to learn how to build queries?
http://wiki.openstreetmap.org/wiki/Overpass_API
http://wiki.openstreetmap.org/wiki/Overpass_API/Language_Guide


This doesn’t work:


[out:json][timeout:25];

(
relation["route"="bus"]
node["highway"="bus_stop"]
  ({{bbox}});
);

out body;
>;
out skel qt;

This one worked for me.
Maybe a little more tweaking is needed to fulfill your needs…

http://overpass-turbo.eu/s/f6B

It is used to show railway and subway stations with different colors (yellow/blue).

Thanks much for the infos.

The code displays the stations names at all times, which makes it hard to read when zooming out:

What I had in mind is that a station name would only be displayed when the user either moves the mouse over it (as tool-tip) or clicks on it.

But maybe OverpassTurbo is simply incapable of doing that.

Indeed, Overpass Turbo is a tool to show data, it’s not really meant to explore data in an interactive way like you want. There is no way to specify popups. You can only define a fixed style.

You could try executing this query from umap. See e.g. http://www.mappa-mercia.org/2014/09/creating-an-always-up-to-date-map.html on how you can combine umap and and Overpass Query.

If that still does not give the UI you want, you will have to learn to program with OpenLayers/Leaflet Javascript libraries.

Your query was wrong (you should repeat the bbox part for both the relation and the nodes

(
relation ;
node;
);

Thanks.

As an alternative, is it possible to query OSM to get ways + nodes including station names as part of the output, download the data as GPX, edit the file, before uploading it to a web site such as Google My Maps where station names will be displayed as POIs?

Hello Shohreh,

I would recommend further tah you shouls get familiar with farmeworks like leafletjs or OpenLayers,

see http://wiki.openstreetmap.org/wiki/Leaflet

and http://wiki.openstreetmap.org/wiki/OpenLayers

Go to each original website, and see the examples / plugins where you can display your own geometries like lines or points, with or without popup markers / lables, by hover wirh mouse or only by clicking one.

IIRC it is also possible to display geometries and points in formats of GPX, KML, geoJSON etc.

Isn’t it a bit heavy just to download a bus/train route?


Edit: I found a work-around:

  1. In OT, download/export relations as GPX, and import file into Umap:

[out:json][timeout:25];
(
  relation["network"="some_network"]["ref"="some_ref"]({{bbox}});
);
out body;
>;
out skel qt;

  1. In OT, download/export nodes (stations) as GPX, and import file into Umap into new layer:

[out:json][timeout:25];
(
  relation["network"="some_network"]["ref"="some_ref"]({{bbox}});
);
node(r);
out body;
>;
out skel qt;

I agree it’s not as clever as doing the whole thing in OT with a single query, but it does the job™.