You are not logged in.

#1 2016-03-16 15:23:51

Shohreh
Member
Registered: 2012-12-15
Posts: 210

[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.

Offline

#2 2016-03-16 17:26:02

stephan75
Member
Registered: 2008-05-28
Posts: 2,870

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

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.

Offline

#3 2016-03-17 22:18:45

Shohreh
Member
Registered: 2012-12-15
Posts: 210

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

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

No experts here know the answer?

Offline

#4 2016-03-17 23:13:02

R0bst3r
Member
Registered: 2015-04-23
Posts: 663

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

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/viewtopi … 81#p583581


OSM Profis sollten Anfänger mehr ermuntern und mehr unterstützen, damit die Gemeinschaft wächst und vielfältiger wird. Momentan vergrault man immer noch gerne.

Offline

#5 2016-03-18 01:06:21

Shohreh
Member
Registered: 2012-12-15
Posts: 210

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

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/Over … uage_Guide

--
This doesn't work:

[out:json][timeout:25];

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

out body;
>;
out skel qt;

Last edited by Shohreh (2016-03-18 01:27:18)

Offline

#6 2016-03-18 17:37:41

marczoutendijk
Member
From: Vught
Registered: 2012-03-04
Posts: 2,298
Website

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

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).

Last edited by marczoutendijk (2016-03-18 17:38:14)


--
There is only one place where you can connect a high voltage line to a river: on osm! (but not in JOSM cool )

Offline

#7 2016-03-21 11:27:16

Shohreh
Member
Registered: 2012-12-15
Posts: 210

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

Thanks much for the infos.

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

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.

Last edited by Shohreh (2016-03-21 11:28:32)

Offline

#8 2016-03-21 13:24:54

escada
Moderator
Registered: 2011-08-13
Posts: 1,750

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

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/cre … e-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 [...]({{bbox}});
node[...]({{bbox}});
);

Offline

#9 2016-03-21 16:58:02

Shohreh
Member
Registered: 2012-12-15
Posts: 210

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

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?

Last edited by Shohreh (2016-03-21 16:58:14)

Offline

#10 2016-03-21 18:12:52

stephan75
Member
Registered: 2008-05-28
Posts: 2,870

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

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.

Offline

#11 2016-03-22 12:33:37

Shohreh
Member
Registered: 2012-12-15
Posts: 210

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

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;

2. 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™.

Last edited by Shohreh (2016-03-22 15:50:06)

Offline

Board footer

Powered by FluxBB