GO Tracker Mashups

GO Transit (the inter-regional transit provider for the greater Toronto area) has a handy online tracking tool for its trains. Naturally, I wanted to get into the data behind it all and produce something that would work outside the default website. So, simply open my GO Tracker KML file in Google Earth, and you’ll get live updates on train and (some) bus locations! The bus data is not (yet) part of GO’s tracking tool, and only includes some bus routes.

Side note: You can also view things in Google Maps, albeit without auto-update, or a version of GO’s own train-only map with no sidebars and extra info… someone took the latter, and made their own version with buses and speeds (thanks Sid!)

The KML file contains a network link (that updates every 20 seconds) to this ASP file on my sever. You can view it your browser, as it’s set to output as a generic XML file (although it’s all valid KML). This made debugging easier, as I could view it in my browser without trying to open Google Earth every time. You can also get bus-only and train-only versions, should you so desire. The ASP file contains some server-side (VBscript) scripting that imports and processes a couple of XML files from GO’s servers, and then produces the info in the desired format.

The hardest part was persuading my (Windows) server to get the XML without complaining, so I reproduce the essential bit of code here to save others the hassle:

Response.ContentType = "text/xml"
Set XMLDoc = Server.CreateObject("Msxml2.ServerXMLHTTP")
XMLDoc.open "GET", "http://www.[long URL cut to fit on one line]", false
XMLDoc.setRequestHeader "Content-type", "application/x-www-form-urlencoded"
XMLDoc.Send
Set Root = XMLDoc.responseXML.documentElement.firstChild

(NB: if you’re debugging and need to view the raw xml, use Response.Write(XMLDoc.responseXML.xml) or similar)

Example train data can be found here, and the bus data can be found here, both for the Lakeshore West corridor. There is also a handy list of all data sources available. The bits in {braces} correspond to variables, most of which I’ve managed to decode. Some of the more interesting/less obvious ones are:

  • {includeEquipmentTrip} = “true” or “false” : shows trains (maybe buses too) that aren’t in revenue service. You’ll see a *lot* of stuff around Union station from the three yards around it
  • {isPublic} = “true” or “false” : When true, produces data is a slightly cleaned-up public-friendly version. Delays seem to be rounded to the nearest minute, for instance
  • {serviceCd} / {serviceId} = “01″, “09″, “21″, “31″, “61″, “65″, or “71″ : The two-digit number corresponding to the corridor. Currently these seem to be the same, bus I suspect {serviceID} is detained to be route-specific for bus data, and {serviceCd} more broad.
  • {lang} = “en” or “fr” : … although you don’t get anything different either way yet.
  • {StationStatus} two- or three-digit station “number”. These don’t match with anything on GO’s website. If you look at an example station status output, the values of the “StopCode” attribute work as values for {StationStatus}. So 12=Danforth, 13=Scarborough, etc. I’ve compiled a full list.

Hopefully the internet can use all this data to produce new and ever-better mashups of GO’s comprehensive live data.

About the Foscam NVISION FI18910W

The Foscam NVISION FI18910W is a wireless IP webcam, and I recently obtained one to use as part of a project involving… a wireless webcam. Overall, the camera itself has worked fine, but the supporting documentation is a bit lacking. So, a few points about it that I will share with other users in the hope that it’s useful

  • You don’t need to install the software on the CD. I know because the CD arrived broken, andI had to cope without. You can access everything through a web browser once you know the IP address of the camera.
  • The green LED beside the network port will blink rapidly when its connected wirelessly. It will take a while (~30 seconds after power-up)
  • The IP address of the camera is generally different in wireless and non-wireless modes. Having carefully configured the wireless network access on the camera through the web interface, you’ll unplug the network cable, wait for the green LED to start blinking rapidly, refresh the browser… and get an sulky “page not found” from your browser. Add one to the last digit of the IP address and try again. (Or do whatever you did to find the wired IP address)
  • You can fix the IP address, using the web interface, so its the same for wireless and wired. Just make sure the first three numbers remain the same as the ‘gateway’ (router IP). The DNS server IP should be the same as the gateway IP.
  • You can access the video stream directly at http://[ip address]/videostream.cgi?user=[username]&pwd=[password]. It’s an MJPEG stream, and be viewed in your video playing software of choice.

First post

The aim of this blog and collection of pages is to provide a place for to post all those things which aren’t directly associated with non-League football, and my ‘main’ website, thePyramid.info. These could relate to things like :

  • Mathematics
  • Ringing (as in change ringing) – particularly the theory thereof
  • The Raspberry Pi (a $35 credit-card sized computer)
  • Transportation, especially transit
  • Anything that tickles my fancy that I feel an urge to share with the world

The name of the site is intended to reflect the eclectic mixture – blocks are generally used to build bigger things, come in all shapes and sizes, and have a discrete existence in their own right.