oEmbed fun

I’m way behind the times, I know, but I’ve finally had the opportunity to help build an oEmbed provider. Check it out in action:

To get the chart in to this post I used the ChartBlocks wordpress plugin.

The plugin adds ChartBlocks as an oEmbed provider for WordPress. This means that when I insert the URL:


in to the post on its own line, the blog visits the oEmbed page at:


to find out how to embed the chart.

This saves me having to grab the embed code for the chart, or update if it it ever changes. The internet is awesome sometimes!

High speed train time comparison

I must disclaim, I have no real interest in trains, but this is my second nerdy train post on the blog in a year!?

With all this talk of a new HS3 line I thought I’d compare reported operating speeds against average speeds across some of the better known lines. The results are in:

I tried to keep the distances similar when calculating average speeds from stations, but didn’t do too well. The average speed is the length of track from Station A to B divided by timetabled route length.

From To Miles Hours
Tokyo Sendai 202 1.05
Paris London 306 2.06
London Birmingham 116.66 0.83
Paris Marseilles 466 3

So it would appear the proposed HS2 will operate at speeds of up to 225mph (25mph faster than the Shinkansen) but still be 76mph slower on average.

ChartBlocks goes in to beta

A project I’ve been working on for some time now has hit public beta. It is called “ChartBlocks” and allows you to design and publish charts online in a number of formats, with analytics and sharing built right in.

This will be the first public embed of a chart from the platform:

If you’re looking to create vector charts, which you can download and publish, or share with the internet (through Facebook, twitter, an embed on your website) sign up for the beta here.

Parsing CIF files to get train schedule data in PHP

I’ve had some fun looking at what data you can get via the National Rail Open Data scheme, and was really impressed by the ActiveMQ implementation they’ve got for Real Time Train Movement Messages!

The messages National Rail send allow you to plot trains to stations, or even along route, but the message only contains station IDs or train IDs – which is kinda boring. I like to visualise the data, on a map for example.

To get the station name and location for a particular train message one has to access an entirely different database, from another provider. Along comes ATOC with their CIF files, which look very scary compared to ActiveMQ.

To cut a long story as short as I can, the CIF files contain a lot of information (400MB+ files), using string length and new lines to split up the data. You can sign up to download the files on the ATOC website, and the specification for the files is available here.

Why the blog post? Well, I needed a way to parse these files to populate a Mongo database and wanted to promote the PHP CIF parser I’ve started work on: https://github.com/rb-cohen/php-cif-parser