[OSM-talk] Public Transport: Line Diagrams

openstreetmap.eggs at neverbox.com openstreetmap.eggs at neverbox.com
Sat Oct 8 10:04:35 BST 2011


Hi All,

I'm trying to create a line diagram[1] for a public transport route
using overpass-api.de[2]. I'm totally new to openstreetmap, so could
use some pointers. The best I can come up with (via [3]) is:

http://78.46.81.38/api/sketch-route?948941

That result has the track split in two and is missing many details:
level crossings, pedestrian underpasses, bridges over road/river,
abandoned stations, that the line becomes single track from Fish Hoek
south, etc. I'm comparing against the given overpass public transport
example:

http://www.overpass-api.de/api/sketch-line?ref=630&network=VRR&style=wuppertal

and the wikipedia page which is more complete:

http://en.wikipedia.org/wiki/Southern_Line_%28Cape_Town%29

I've tried to improve this by constructing a query similar to the
German railway example -- which requires a train network name & line
number. I exported the relevant XML segment[3] using:

<union>
    <bbox-query s="-34.2" n="-33.9" w="18.4" e="18.5"/>
    <recurse type="node-relation" into="rels"/>
    <recurse type="node-way"/>
    <recurse type="way-relation"/>
</union>
<print/>

which shows a station marked as:

<node id="26114598" lat="-34.0459915" lon="18.4655501">
    <tag k="name" v="Heathfield"/>
    <tag k="operator" v="Metrorail"/>
    <tag k="railway" v="station"/>
</node>

There appears to be no network name associated with these train
stations, unless that's normally taken from the "operator" attribute
value. I can't spot any service/line numbers. Is all of this just
missing from the map or what?

I found the magic relation number 948941 on openstreetmap.org[5]. Are
relations stored on the map? I couldn't find that on the map I
extracted:

$ grep 948941 metrorail.xml

The XML relation I found online[6] does have:

<tag k="network" v="Cape Metrorail"/>

but still no service/line number(s). From my reading that's marked as
a ref attribute on the relation element. I'm trying to construct the
following URL:

http://www.overpass-api.de/api/sketch-line?ref=fu&network=bar

and now have the network, but not the ref (missing?).

If anyone knows of other means of generating these public transport
line diagrams, that would be much appreciated. I also tried
JOSM-Xalan. That produced a nastily cropped SVG, which would need a
lot of transforming/resizing work to make text labels and other nodes
visible.

I suppose there is an XSLT file that overpass uses which could be
modified to work or should I be adding ref attributes somewhere?

Many thanks.


--
1. http://wiki.openstreetmap.org/wiki/OSM_Server_Side_Script#Public_Transport_Example
2. http://www.overpass-api.de/public_transport.html
3. http://wiki.openstreetmap.org/wiki/WikiProject_South_Africa/Public_transport_routes#Metrorail_2
4. http://www.overpass-api.de/query_form.html
5. http://www.openstreetmap.org/browse/relation/948941
6. http://api.openstreetmap.org/api/0.6/relation/948941




More information about the talk mailing list