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.

Getting the Data
The NHS provided me with a link to a Google map:
https://maps.google.com/maps/ms?authuser=0&vps=5&ie=UTF8 &hl=en&oe=UTF8&msa=0&output=kml &msid=213551442652291377405.0004daf3ca79fc04df02e
It's really easy to get Google Maps to spit out KML. All you really need is the msid:
https://www.google.co.uk/maps/ms?ie=UTF8&hl=en&vps=1&jsv=280a &msa=0&output=kml &msid=213551442652291377405.0004daf3ca79fc04df02e
Hey presto - one KML file.
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.

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,
position.coords.latitude)
.transform(
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.
);
});
Feedback
One satisfied customer :-)






Open Data + Open Source = Big Win For Society
Improvements
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.
6 thoughts on “iOS Only Kills - Open Data Saves Lives”
Trackbacks and Pingbacks