Exploring local crime data via data.police.uk


I noticed last week that the good folk at data.police.uk have recently introduced some new features in their API, in particular the ability to get street-level crime data for custom geographic areas.

So, I decided to give that a try, focussing on the possibilities for querying for crime data in Wards.   The result is this application.

The Local Crimes app: features and functionality

The app opens with drop down lists of:

  • Dates (year and month, as “YYYY-MM”) for which street-level data is available via the Police API
  • All Local Authorities in England – which I retrieve by querying DCLG’s OpenDataCommunities
  • Wards falling within the selected local Authority.

The app defaults to Adur district council, the first entry in the alphabetical list, but you can select any council from the drop down.

On selecting a local authority, the app automatically discovers associated Wards by querying boundary files that I’ve acquired and processed from ONS’s Open Geography Portal : specifically, the December 2012 set, accessible via the ‘Download products’ tab.

The app then cycles through the list of wards, querying data.police.uk to retrieve the list of street-level crimes in each ward, for the selected month.

The result is a visualisation with three main elements.  

First, we have a map of wards in the selected district, shaded according to the total number of crimes listed in the given month.   You can click on any Ward, and see more detailed information (in a pie chart) about the number and type of crimes in that area.

main map

Next to the pie chart, you’ll find a button to map individual crimes within the selected ward.

incidentmap

Hovering over a map points will display details about that crime’s category and location.

The second main element is a bar chart showing the percentage distribution of different crime categories in the select month, across the selected authority and its constituent Wards.

ward chart

The third element lets you explore the full list of crimes in the selected authority, by clicking on the “view the full list” button – located in the title just above the main map. This opens a separate window, containing a table that you can sort by clicking on column headings, and filter by typing key words in the search box.

crime list

Caveats and conclusions

As the Police API does not allow custom areas larger than 20 square kilometres,  the app is unable to retrieve data for a number of wards – particularly in the more rural areas.   In these cases, wards will be shaded grey, with no data on street-level crimes.

It may also fail to load data for a few local authorities, due to some residual bugs with the underlying map data for those areas.  I’m working on sorting that soon.

Oh, and it doesn’t work in Internet Explorer version 8 or earlier.  I’ll spare you the horrible technical explanation.

Apart from that, it seems to works fairly well, and has given me a shopping list of new features for the Police API.

I also have ideas on combining crime data with related public sources that are available now via third-party APIs .   Watch this space, and in the mean time please do try it out and let me know what you think.

Thanks

Advertisement

One response to “Exploring local crime data via data.police.uk

  1. Hi,
    I wanted to ask if your source code is open source? I wanted to have a look at how you implemented the API in your own app and called the data?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s