Matt Dray (@mattdray)
Deer roam Scotland. So do humans. It’s a problem when they meet at high speed.
The data are open. I found the dataset when skimming through data.gov.uk (a classic weekend activity for all the family). It links to the SNH Natural Spaces site where you can download the data as shapefile, GML or KML under the Open Government Licence.
I couldn’t find an interactive visualisation of these data and I don’t spend much time working with R Shiny,1 so why not.
A simple Shiny app
I recommend you check out the full-screen app live at mattdray.shinyapps.io/scot-deer-collisions/.
I’ve embedded a compact version of it below (it’ll take a moment to load). Click the for the options menu to start filtering the data.
It was built in R with:
shinydashboardpackage for a nice layout and value boxes
leafletpackage for the interactive map
DTpackage for the interactive datatable
In case you still aren’t sure, here’s a gif of the full app in action.
I may update the app in future or take it down entirely. It’s hosted for free at shinyapps.io, which means that it can only receive a fixed number of visits each month before it becomes unavailable. The code will continue to exist on GitHub where you can leave an issue or fork it to make it better.
I limited the filters to year, month and local authority. I could have included deer species and road, but the data are sparse and the formatting wasn’t great. I cleaned these variables up a bit and they’re available as filterable columns in the interactive table.
There’s a large number of points and it doesn’t make sense to show them all at once because it slows the app down. There are methods for improving this, but I assume most people will be looking at specific local authorities or roads rather than the country as a whole.