This is a guest blog post by Pepijn Mores, a student at HELMo Saint-Marie. In this blog post he shows how easy it is to create an app to fulfill his own transportation needs, which we thought is very interesting: it is not always the big companies that use the data from the SNCB. Would you like to write a blog post here yourself? Contact us!
For the final project of my C# course at HELMo Saint-Marie, I had the opportunity to choose my very own topic. Only two requirements needed to be met: it had to be developed in C# (obviously) and it had to involve a technology we didn’t study in class. The amount of possibilities was enormous , therefore I decided to search for a subject that would actually be helpful to me in some way. Because I return home every weekend and the train takes about 1,5h, I came up with the idea to make an application for my PC that would look up the train tables and check if I had enough time for a sandwich at Panos at one of the changes. It was the perfect solution for me to look up the trains when I was attending my last course on Friday afternoon, so that I could plan my trip home whilst sitting in class. So that’s where the API of iRail came in.
I studied the structure of the XML file the API returned and noticed the large amount of information it contained. I expected it to be just a list of stations with arrival and departure times, but instead I was surprised by information like the exact coordinates of the train stations and the code of the vehicle. I was stunned by the potential this data had. But because I had to meet a tight deadline and exams were coming up, I decided to stick to my original idea.
The transformation of the data of the XML into my own defined models was done using the Language Integrated Query (LINQ) feature in Visual Studio. After the transformation, the user can view the data in Windows Forms and access the connections details (with the note if there is time for a little snack).
I designed 3 simple views: one setup view, one view with a list of all connections and one detailed view. The setup view just takes the basic details needed to perform the request, the list view gives the user an overview over the coming connections and the detail view gives the user the exact hour and platform of departure/arrival.
The main thing I learned by developing this little application is not how much fun it is to work with LINQ or C#, nor did I learn to design a beautiful user interface (I am sorry if the bright red hurts your eyes). But I did learn that data on (public) transportation should be widely available and implemented in projects. Thanks to iRail, I recognised the opportunities and challenges that are present on public transport and open data in Belgium. Data on public transport carries a huge potential and inspired me to work on another train-related subject in the future (GTFS, yes I am looking at you).