Hot Otter Action Near You
Apparently, you're never more than about 3m from a rat at any given time. On the basis the evidence from this weekend, you're not that far from an otter, either.
env[:Hack] was a hackday organised by the Environment Agency and held in Bristol. It showcased a whole range or more-or-less environmentally-focussed data sets,
Otters don't really lend themselves terribly well to puns, once you've gone beyond the obvious "it's getting otter in here / that's an otterly terrible pun" combinations. Tweaking the UI late on Saturday night it suddenly occured to me that otters' lack of opposable thumbs not withstanding, the basic mechanism of the app is fundamentally the same as Grindr. So the strapline was born. OtterSpotter - it's Grindr for ottrs.
The science bit
The data's derived from 35-years-worth of otter surveys collated by the Environment Agency. Every seven years or so, there's a count of otter activity in various locations across the UK, and that data has been aggregated together into a single spreadsheet. It shows locations where signs of otters have been sighted, and checks for their presence in subsequent surveys.
The first challenge is that - as usual - the location data is captured as Ordnance Survey grid references, rather than latitude/longitude data. This needs to be converted, and the maths isn't trivial - fortunately there are an increasing number of libraries available to handle the calculations. From conversations with various OS people, it also seems that it's an issue that they're aware of and are doing something to change.
As part of the conversion process, the CSV data was imported into a Rails-based back end. That has a simple REST API which currently handles a single request. Assuming the request specifies the upper-left and lower-right coordinates of a bounding box, the API responds with a list of otter sightings within that region as a blob of JSON.
The JSON can be consumed by anything that can handle it - in this case, it's an iOS app that iterates over the JSON and plots pins onto a MapKit view. The pins have custom images with an animated placement, so cartoon otters appear to fall from the sky - the opacity of the pins is adjusted according to the recency of the sightings, so older locations fade relative to the newer ones. The data also includes mink sightings - because mink and otters don't get along, tombstones replace otters in these locations.