UK Railways Stations & Airports

Hello,

Can anyone tell me if it’s possible to extract a list of UK Railway Stations and Airports from OSM please?

I am trying to get the latitude/longitude for each and every station/airport.

If this can be done, can anyone give me some pointers please?

Many thanks

Trev

you should be able to do it with the http://wiki.openstreetmap.org/wiki/Xapi by specifiying a bounding box and railway=station.

These Xapi queries should work:
all stations in the UK:

http://xapi.openstreetmap.org/api/0.6/*[railway=station][bbox=-7.7,49.8,1.7,61.1]

and all airports in the UK:

http://xapi.openstreetmap.org/api/0.6/*[aeroway=aerodrome][bbox=-7.7,49.8,1.7,61.1]

Note this is a rough estimate for the bounding box, so it may have missed some parts, and it includes part of the Republic of Ireland as well.
This will get you the data in OSM XML format. If you want a list you could use probably GPSBabel to convert to CSV format.
Also note some stations and airports may be mapped as areas instead of (or as well as) nodes.

Hi,

Thanks for the help! Perfect!

I have managed to get the data into csv file so I should be able to create some database tables from it now.

The only small question I have is that the description of each item in the file is “osm-id XXXXXXXX”. Is there somekind of lookup table I need to convert these to real names?

Thanks

Trev

Sorry, just to add…

I have had a look at the raw xml file and it DOES indeed contain the names I need…

I have had a good look around GPSBabel but have been unable to see how to extract these names into the csv file.

Can anyone give me any pointers please

Thanks

Using CSV format, try and enable the “prefer_shortnames” option.
If you’re using the GPSBabel GUI, you can click on the icon for options for the output format, and tick the box for “use shortname instead of description”. Or from the command line, use something like -o csv,prefer_shortnames=1 -F “test.csv”

Then I think it should output the names instead of the osm-id.

Hi -

I’ve got exactly the same problem - I need a list of UK railway stations with lat/long.
I’ve only signed up today so maybe I’m doing something silly, but I tried putting the xapi request into my browser and the browser couldn’t connect.
Can anybody tell me what I’m doing wrong?

The xapi.openstreetmap.org server has been down for a while.
There are a few alternative XAPI servers, see the list here: http://wiki.openstreetmap.org/wiki/Xapi
Though I’m not sure which ones are working just now. I think open.mapquestapi.com is working. Though note it is limited to 10 square degrees, so you can’t get the whole of the UK at once.

Or you could try the Overpass API, see this section for the XAPI Compatibility Layer: http://wiki.openstreetmap.org/wiki/Overpass_API#XAPI_Compatibility_Layer

Have a look at the OSM wiki about http://wiki.openstreetmap.org/wiki/Overpass_API

Also do a text search about “xapi” or “overpass” at the FAQ site http://help.openstreetmap.org

Many thanks everybody for the very generous help.

I’m surprised that it’s so difficult to get such a basic set of data.

I’ve decided that my best bet for a reasonably accurate list is to use the Wikipedia data at http://en.wikipedia.org/wiki/UK_railway_stations_%E2%80%93_A and following. This has postcodes for each station and I can use the postcode/location data on the O/S Open Data site to add a lat/long.

Thanks again

Tony Reynolds