iOS Only Kills - Open Data Saves Lives

A slightly tongue-in-cheek title for quite a serious subject.

The South Central Ambulance Service NHS Foundation Trust have a list of emergency defibrillators available for public use. To help raise awareness, they've released an app...

Of course, it's iPhone and iPad only. Who cares if Android, BlackBerry, or Windows users want to save a life, right?

Rather than doing anything constructive with my day, I snarked on Twitter.

Well, how hard can it be to plot points on a map? So, I threw myself into the challenge over my lunch break. Turns out, it's really easy. You can play with my demo on your phone.

AED Mobile Web Screenshot Detail

Getting the Data

The NHS provided me with a link to a Google map:

It's really easy to get Google Maps to spit out KML. All you really need is the msid:

Hey presto - one KML file.
AED Mobile Web Screenshot Map

Drawing The Map

Google Maps is so passée - and hides some fairly nasty gotchas - so I used OpenStreetMap. I find that OpenLayers is the easiest way of making OpenStreetMap look beautiful on mobile - and it natively supports KML imports.

AED Mobile Web Screenshot no streetview

Finding Oneself

A user, presumably, wants to find the closest AED to where she is right now - so I wanted to geolocate the user's phone. The OpenLayers geolocation code was a bit to complex for a very quick hack, so I just went with

navigator.geolocation.getCurrentPosition(function(position) {
var lonLat = new OpenLayers.LonLat(position.coords.longitude,
                new OpenLayers.Projection("EPSG:4326"), //transform from WGS 1984
                map.getProjectionObject() //to Spherical Mercator Projection
   map.setCenter(lonLat, 15 // Zoom level - Not too far in, or the user may not see what's going on.


One satisfied customer 🙂

Open Data + Open Source = Big Win For Society


This was a quick hack, to be worked on by others with more free time. Here are some things which need changing.

  • The KML file is static - ideally it should be loaded dynamically from a canonical source.
  • Geolocation doesn't track the user. Ideally she should see if she's getting closer to an AED.
  • Pins could do with being bigger, and perhaps a different colour.
  • Needs links to official sources so the user can trust it.
  • Needs an icon so the user can install it to the screen of her phone.
  • Potential to use HTML5 to cache the KML file for offline use.

If you want to play around with the code - it is available on GitHub.

Share this post on…

6 thoughts on “iOS Only Kills - Open Data Saves Lives”

  1. Upload the kml to After upload you have a nice gui for manipulating the data. Use the cartodb sql api to download data to your client, or (the super-easy way) use the cartodb html map client.

  2. An alternative - and I would say better - approach would be to enter the data directly into OSM, and then to make your own render of it, using the tools and styles of your preference. The data would then be available to anyone wanting to render or otherwise reuse, or improve it, along with that of neighbouring providers.

    The important thing in that case would be to ensure that any updates made by South Central Ambulance Service NHS Foundation Trust (and doesn't that just trip off the tongue!) are mirrored in the OSM database. That could mean SCASNHSFT making the changes, or pushing the info to the OSM community or a willing third party. If only there were a mobile telephony company interested in facilitating such public service...


Trackbacks and Pingbacks

What are your reckons?

All comments are moderated and may not be published immediately. Your email address will not be published.Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <p> <pre> <br> <img src="" alt="" title="" srcset="">