Thursday 29 October 2015

TrafficControl: How KML Files Represent Coordinates

In two blog posts: Continuing Blog and TrafficControl: Looking into Javascript, I discussed the KML file that contains the coordinates tracks and stations in Skåne.

That KML file is essentially a XML file and contains stations and tracks as placemarks:

The coordinates for Lund_C are highlighted.

The coordinates for Stångby are highlighted
The tracks are represented as an array of coordinates:

The coordinate for the track from Lund C to Stångby
The track is shown below.

The track dLunStaN leaves from Lund_C and arrices at Stangby.
I created a script that mapped the start and end of each track to the closest station. In this case, Lund C and Stånby were connected to LunStaN.

For this example, the script created three eight lines of code that will be used in TrafficControl:
ADD STATION Lund_C
ADD STATION Stångby
ADD TRACK dLun-StaN 5159
ADD TRACK dLun-StaS 5159
CONNECT TRACK dLun-StaN FROM Lund_C TO Stångby WITH PRIORITY
CONNECT TRACK dLun-StaN FROM Stångby TO Lund_C
CONNECT TRACK dLun-StaN FROM Stångby TO Lund_C
CONNECT TRACK dLun-StaS FROM Stångby TO Lund_C WITH PRIORITY

The "WITH PRIORITY" tag indicates that the track will have the prioritized direction from Lund_C to Stångby.

The naming convention of the tracks is for example: dCph-JHylWW
  • d indicates that the track is a double track (create a corresponding track in the eastbound direction). 
  • Cph indicates the first station is a station.
  • JHylW is the name of the end junction. J indicates junction and W indicates the location related to Hyllie.
  • W is the direction of the track.

I'll discuss the algorithm in detail in a future blog post.


Saturday 19 September 2015

Genealogy: Anatomy of the ScanGed Python Script

The algorithm for scanning GED files is quite simple and it is based on recursion:

Start from a person in the family tree,
Collect the desired information about that person and print it to a a line.
Repeat for father, if found.
Repeat for mother, if found.

I've used dictionaries in Python, so that the script will know what line to look for a persons/familys section in the GED file. This will make the program much faster.

The source can be found on my public DropBox.


Monday 31 August 2015

Genealogy: Creating Compact Ancestral Charts from Gedfiles

I've spent several hours doing some genealogical research for my ancestors. The most interesting finding so far is a remote relative (my mother's cousin's grand-grand-grand-grand-grandfather Caspar Mathisson), who was the pilot onboard the ship when the ship ran aground half a mile900 m from Göteborg in 1743 after a trip to China. https://en.wikipedia.org/wiki/G%C3%B6theborg_(ship)

Using Ancestry.com, and the Gramps software, I've found lots of persons back to the 17th century. 

However, I lacked one visualization tool for the shoe box situation: 
Often, one very proactive person does a lot of research. After a while, the results will end up in a shoe box on the attic for some decades. In the case of papers and photographies, it is easy to resume the research. In the case of data files, it will be much harder (just imagine how to retrieve data from a computer of the '80s). Therefore, the data must be in printed form, independent of computers or programs.

On the other hand, a family tree will be hard to read if  there are many persons in it. And printing a 100-person GEDCOM file will require 40 pages, and that is too much. 

I'll print the final results of the file now (for privacy reasons, this example starts with my grand-grandfather) and I'll describe the function and anatomy of the program later:

Monday 15 June 2015

South Africa: My First (and Only) Bungy Jump

After being harassed baboons but before being hunted by elephants, I did my first bungy jump from the Bloukrants Bridge on the Garden Route in South Africa.


With a height of 216 meters, it is one of the highest jumps in the world - and an excellent excuse not to do more jumps. "Naah, I will only be dissapointed jumping 192 meters".





The jump took approximately five seconds, but felt more like twenty. Falling through the air was definitely worth it!


Monday 8 June 2015

TrafficControl: Now on Github

I just added TrafficControl to GitHub for two reasons:

  • Having a simple way of keeping track of future versions of the code
  • Sharing my project under GPL 3.0.

My project is available at https://github.com/cutetrains/trafficControl-dev.





Monday 1 June 2015

Africa: Running from Elephants and Keeping the Blog Alive

Here is a video of some elephants from the trip in Africa 2014. 


Highlights: 
  • 1:24 I'm chased by an angry elephant
  • 1:40 The person in the tree next to the elephants.
  • 2:13 The cutest elephant kid ever!





Most of the photos/videos are from the Kruger National Park in South Africa.

I've been focusing on genealogy lately, so the blogging has been suffering. I will resume the blog and keep it updated at least twice a month. The contents will be photos/videos, programming, trains and perhaps some genealogy.

Wednesday 4 February 2015

Old Tracks: LTJ Railroad (Lund to Trelleborg)

Google Maps window The railway between Lund-Staffanstorp-Svedala-Trelleborg is one of the older railways in Skåne and is now almost completely removed.

It was in use between 1875 and 1960, initially private-owned. Trelleborg is one of the bigger ports in Sweden and the railroad connected that port with some bigger towns including Lund (and later Landskrona).



If you zoom closely, you can see that old railroads still has left some traces in the landscape. You can see that near Klågerup, a village south of Staffanstorp.


Monday 12 January 2015

New York, NY: High line

The High Line is a former railway that is a park in the Lower West side of Manhattan. The railway was in use between the 1930's and 1960's.






The park is slightly longer than 2 km and definitely worth a visit.