OpenStreetMap station data

Here is some quick postgis sql that I used to knock up kml of railway station sites in England.

SELECT node.*
FROM
  node_tags tag, nodes node
WHERE tag.k='railway' and tag.v='station'
  and tag.node_id = node.id


SELECT node.*, '<Placemark><name>' || nametag.v || '</name>' || ST_AsKML(node.geom) || '</Placemark>'
FROM
  node_tags tag, nodes node, node_tags nametag
WHERE tag.k='railway' and tag.v='station'
  and tag.node_id = node.id
  and nametag.k='name'
  and node.id = nametag.node_id

Inspired by this, I have forked traingraph to look at adding my own flourishes.

openstreetmap geo hacking
It's All In The Game blog (c) 2005-16 by Jez Nicholson