Irish Commuter Rail (DART) information in Real-Time
Why?
AngularJS works with JSON not XML. JSON is preferred to XML for RESTful API's. JSON takes less bandwidth to transmit, is simpler to understand visually and is far easier to deal with on the client as it works seamlessly with javascript. Geo JSON is a JSON format specifically designed for geographic applications.
App Functionality
NodeJS server gets real time train data in XML format from the Irish Rail API for the DART commuter rail. The XML data is then converted to javascript. String manipulation is performed to create an Object in the Geo JSON format. The Object is send via socket.io. Socket.io serialises the transmitted data as JSON. The client will receive the train data as Geo JSON.
The client renders a map in the browser with the help of leafletJS. Leaflet-realtime is used to work with the realtime data read from the server.
Main Technologies Used
- NodeJS
- ExpressJS
- AngularJS
- Socket.io
- BT Ford's socket.io Angular Module
- Simplified HTTP request client
- xml2js XML to JavaScript object converter
- Geo JSON
- LeafletJS
- leaflet-realtime
Running the App
- clone the repository
- npm install
- bower install
- node server.js
- browse to http://localhost:3000/
- Be patient
- Realtime DART train locations will appear on a map centered around connolly station
- Click on an icon for specific train info
Screen Shots
Michael Cullen 2014