March 16, 2016, 2:23pm
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?
March 16, 2016, 4:26pm
To dvelop such a query, I recommend to learn something about the tagging of OSM elements.
You are familiar with things like
Then in detail, see
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.
March 17, 2016, 9:18pm
Thanks but I don’t know what to do with the above.
No experts here know the answer?
March 17, 2016, 10:13pm
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
March 18, 2016, 12:06am
It’s quite above my head, but the following works:
out skel qt;
This does download a bus route in the area that was displayed in OverpassTurbo, but…
It’s missing the stations, each with its name: I guess I should add “node” somewhere
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?
This doesn’t work:
out skel qt;
This one worked for me.
Maybe a little more tweaking is needed to fulfill your needs…
It is used to show railway and subway stations with different colors (yellow/blue).
March 21, 2016, 10:27am
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.
March 21, 2016, 12:24pm
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.
Your query was wrong (you should repeat the bbox part for both the relation and the nodes
March 21, 2016, 3:58pm
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?
March 21, 2016, 5:12pm
I would recommend further tah you shouls get familiar with farmeworks like leafletjs or 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.
March 22, 2016, 11:33am
Isn’t it a bit heavy just to download a bus/train route?
Edit: I found a work-around:
In OT, download/export relations as GPX, and import file into Umap:
out skel qt;
In OT, download/export nodes (stations) as GPX, and import file into Umap into new layer:
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™.