Reading Time: 5 minutes

Last Tuesday night's  demonstration of the MuleSoft's Eclipse Tool Suite at the Vancouver Eclipse Demo Camp went well. I almost got Nerf-gunned for a (slight) overtime but the organizers' mercifulness has allowed me reach the end of the demo with a running sample 🙂 For those who weren't there, here is a summary of my presentation.

The challenge I've set to myself for this demonstration was the following: let's figure out what's the total length of roadworks currently happening in the city of Vancouver. Think of it as a reality check for your tax dollars at work!

latest report
Learn why we are the Leaders in management and

Because Vancouver exposes plenty of its data on the web, this was really just a matter of pulling the right source and transforming it to the desired output. Read on to find how I achieved this using Mule Data Integrator and Mule IDE

The following image is a graphical representation of the roadworks in Vancouver, where the work in process is represented as orange lines on top of the affected streets:

Vancouver roadworks

The data used to build this view is available on-line as a geo-tagged atom feed: each entry in the feed describes a roadwork, whether active or planned, and each roadwork bears a geolocation tag that is either a single pair of coordinates (a point) or a list thereof (forming a multi-segment line).

To handle the geolocation information, I have created a pair of POJOs that can represent a list of multi-segment lines out of their coordinates. These POJOs are also able to compute the total distance represented by the different geographical segments.

Here is the atom_to_java map I have created thanks to the Mule Data Integrator (click on the image to see it full size):

atom_to_java_map

Notice that I have added a filter to the output loop. I am indeed only interested by mapping the atom feed's entries that:

  • Represent roadwork in process, which is done by selecting the value found in the term attribute of the first (and only) category element of the entry and checking it is equal to ‘In Process'.
  • Has a georss:line element, as some entries only have a georss:point element (not very useful for calculating a distance!).

Using Mule IDE, I have created a new Mule project and a new configuration file, which is shown here:

The configuration itself is a simple HTTP bridge between a local server hosted on and the live atom feed from vancouver.ca. The important part of the work happens in the response transformers stack, where the feed gets turned into POJOs by a Mule Data Integrator‘s transformer configured with the above map.

With this configuration running in Eclipse, here is what a call on the local server looks like:

Yep, that's 32 kilometers of roadworks. Aren't you glad public transit exists?

If you have Mule Data Integrator and Mule IDE installed on your machine, then grab the roadworks demo projects and have fun!