CRS, TIPLOC, Latitude and Longitude - Oh My!

804 views
Skip to first unread message

Prof Falken

unread,
Feb 15, 2013, 12:15:08 PM2/15/13
to openrail...@googlegroups.com
Hi all,

So having worked out the differences thanks to the wiki between the TD and MVT feeds and determined which one is most appropriate for my needs, I'm now moving on to mapping train movements to a geographic location.

I downloaded the NaPTAN csv zip and found that whilst it has very useful data in it, it does not have Lat/Long data, only North/East.

The XML file does have this data in it, however unlike the CSV it is not split into various services so I need to read in the entire XML file (which, at 512M, almost immediately gets punched by OOMKiller on most of my linux boxes!), work out which stops I need and then import those into the database.

I then found the link to http://trains.barrycarlyon.co.uk/data/locations/ and the MySQL dump that is available there, however unfortunately for me the geo-data is not part of that data set.

I guess my first question is "Can I get a copy of the XML file from anywhere split into chunks in the same way that the CSV file is done?".  My second question (which should probably be my first now that I think about it!) is "What is the best source of TIPLOC/CRS data that has the latitude/longitude of each point?" (i.e. is there an alternative to NaPTAN in this respect?).

If anyone can help, I'd be very grateful!

Kind regards,

Matt

Peter Hicks

unread,
Feb 15, 2013, 12:24:53 PM2/15/13
to Prof Falken, openrail...@googlegroups.com
Hi Matt

On 15 Feb 2013, at 17:15, Prof Falken <mattm...@gmail.com> wrote:

The XML file does have this data in it, however unlike the CSV it is not split into various services so I need to read in the entire XML file (which, at 512M, almost immediately gets punched by OOMKiller on most of my linux boxes!), work out which stops I need and then import those into the database.

Look at using a streaming XML parser, rather than reading the entire thing in.

My second question (which should probably be my first now that I think about it!) is "What is the best source of TIPLOC/CRS data that has the latitude/longitude of each point?" (i.e. is there an alternative to NaPTAN in this respect?).

Have a look at http://nrodwiki.rockshore.net/index.php/AddingJunctionsAndSidingsToOsm - we're trying to get TIPLOC data in to OpenStreetMap for everyone to use, and so we don't all have our own little 'cache' of differently accurate geodata.

Be aware that CRS codes can cover a large geographical area (Clapham Junction - CLJ - is a good example, and there are others).  Positions of TIPLOCs are probably better, but as you're working with TRUST data - the movement feed - you may want to work in terms of STANOXes instead, as this is what TRUST spits out.

I'm talking with Network Rail about geospatial and getting snapshots of data from them which we can then punt in to OpenStreetMap.


Peter


Emil

unread,
Feb 15, 2013, 1:14:26 PM2/15/13
to openrail...@googlegroups.com
Just to reply on a tangent, for converting between easting/northing and longitude/latitude, you can use the following PHP code:


In my unscientific test of several solutions to this problem, I've found this bit of software to be the most accurate. I work in Python, so calling the code is a little messy.... I'd be interested in hearing other people's solutions to this problem.



--
You received this message because you are subscribed to the Google Groups "A gathering place for the Open Rail Data community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to openraildata-t...@googlegroups.com.
To post to this group, send an email to openrail...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Peter Hicks

unread,
Feb 15, 2013, 1:17:42 PM2/15/13
to Emil, openraildata-talk

Proj4 - http://trac.osgeo.org/proj/ - Swiss army knife of geospatial conversion.

P

Emil

unread,
Feb 15, 2013, 1:25:02 PM2/15/13
to Peter Hicks, openraildata-talk
Thanks! I'll investigate it's accuracy. By the way, it can be installed on a Mac via homebrew:

$ brew install proj

Emil

unread,
Feb 15, 2013, 1:47:38 PM2/15/13
to openraildata-talk
Seems pretty good! In case anyone else is interested, here's how to use proj4 from Python:

$ brew install proj
$ pip install pyproj

>>> from pyproj import Proj, transform
>>> P1 = Proj('+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +datum=OSGB36 +units=m +no_defs')
>>> P2 = Proj('+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')
>>> transform(P1, P2, 531640,183715)
(-0.1033521696828044, 51.536996449762476)

Prof Falken

unread,
Feb 16, 2013, 1:11:35 PM2/16/13
to openrail...@googlegroups.com
Thanks both, I'll take a look and see what I can do :)

Matt

Mark Waldron

unread,
Oct 18, 2013, 4:09:49 AM10/18/13
to openrail...@googlegroups.com, Prof Falken
HI Peter,

I am just at the point now where I also need location data for STANOX / TIPLOC and cam e across this old post. I see that you may have started something with OSM. 

How has this progressed? Is there data there that I can use?


Cheers,

Mark

Peter Hicks

unread,
Oct 21, 2013, 4:31:03 AM10/21/13
to Mark Waldron, openrail...@googlegroups.com, Prof Falken
Hi Mark

On 18 Oct 2013, at 09:09, Mark Waldron <ma...@undercovermonkey.co.uk> wrote:

I am just at the point now where I also need location data for STANOX / TIPLOC and cam e across this old post. I see that you may have started something with OSM. 

How has this progressed? Is there data there that I can use?

There isn't a definitive source that I know of - the OSM thing ground to a halt when we came across some problems:

  * On a multiple-track railway, where do you put the 'point' for the STANOX?  Or do you make it an area?  If so, where do you define the limits of the area?
  * Where a TIPLOC refers to a signal, how do you know where the signal is, and on which line it is when the lines may not be drawn accurately?
  * Where a station has one CRS code but multiple TIPLOCs, where do you attach the CRS and TIPLOC nodes?
  * Should we include STANOXes, or just TIPLOCs?

There's an FoI request at https://www.whatdotheyknow.com/request/tiploc_locations which asks for the latitude and longitude of all TIPLOCs, however the response doesn't have the geospatial data, only the NLC of locations.


Peter


Mark Waldron

unread,
Oct 21, 2013, 5:04:15 AM10/21/13
to openrail...@googlegroups.com, Mark Waldron, Prof Falken
Thanks Peter,

I am not sure how useful that data from the FOL request will be though. 

I have the NaPTAN data and this is a good start. Whilst it looks like there is no definitive set of data for TIPLOC locations does anyone know of any data that expands on the data we have from NaPTAN?

I think I will have to start with just the NaPTAN and expand on that when more data becomes available.

Part of what I am planning would be map based. If time permits I could possibly create an editable version of the map with a satellite overlay. I could put the unknown TIPLOCS on the map and make them editable. I would use a best guess of their location based on the Train Movements data. If I made this publicly editable we could possibly move toward an 'acceptably correct' set of data. It wouldn't be perfect but it would be better than nothing.
Reply all
Reply to author
Forward
0 new messages