Tuesday 31 May 2016

Recording mileposts

Milepost recording on NZ Rail Maps has been going for some months, maybe a year and a half, and the positions come from the Kiwirail Alcam data. Mileposts have been recorded up until now as features, with the distance recorded in the caption field. It has now been decided to store them as stations. Six new fields have been added to the stations tables, being two sets of three fields. When a milepost is recorded, it can have two sets of attributes if it is a zero peg or some other peg that records the attributes pertaining to two different lines. An interesting example that is not a zero peg is found on the first few km out of Wellington where the mileages for the Wairarapa Line and NIMT run side by side on the same physical tracks. However the Alcam map does not show anything for the Wairarapa Line until 1.8 km, while other sources confirm the duality of mileposts from 0 km. 

The reason for putting the data into the Stations table is that the same labels formula can be used for both mileposts and stations, which allows distance data to be recorded for stations as well. The label formula looks like this:

trim(concat("caption", ' ', "Distance",' ', "Unit", ' ', "Label", ' ',"Distance 2",' ', "Unit 2", ' ',"Label 2", ' '))

In simple terms this is outputting a string that consists of seven of the nine fields of the table joined together, with spaces between them. Provided we only put data into fields where it is actually needed, for example the units and labels are left null where the distance has not been filled in, then the label will be formatted correctly. The design of the fields allows for older type mileposts that are actually in miles or chains to be input for lines where these were the known distances. On old S&I diagrams signals and interlocked devices outside station limits were named using a number made up from miles and chains, and these can also be input using this system as long as the correct units are stated.

The reason for changing the data storage from the features table to the stations table was that the means of displaying the data was reviewed. Previously a typical milepost caption looked like ...k. where the dots represent numbers and the k represents kilometres. For example 187k5 was the caption with the letter k being where the decimal point would normally be. The problem with this representation is that while 187.5 km is clear and unambiguous, 187k5 could be either 187.5 km or 187.05 km, although it was always assumed that it mean the former value. Converting the data to actual numbers also makes it easier to sort and in theory should make it easy to put the data into a table in a hardcopy or electronic publication. The distance fields are stored as a maximum of 7 digits with 4 digits after the decimal point, but when they are fed into the concat function as above, trailing zeroes are eliminated.

A milepost is not "current" or "former" as it is not necessarily a physical representation. However signals will be current or former.