Skip to content

Repository files navigation

ukpd

npm version CI

A Node.js client for the UK Police API.

Installation

  • npm install ukpd --save
const UKPD = require('ukpd')

try {
  const data = await UKPD.streetLevel(52.629729, -1.131592)
  console.log('data!', data)
} catch (err) {
  console.error('An error occurred', err)
}

To retrieve crimes within a street-level custom area, pass a polygon as colon-separated latitude/longitude pairs to streetLevelCustomArea:

const poly = '52.629729,-1.131592:52.630729,-1.131592:52.630729,-1.130592:52.629729,-1.130592'
const data = await UKPD.streetLevelCustomArea(poly)

Rate-limited requests are retried up to three times after waiting for the number of seconds returned in the API response's retry_after field.

You can find more information by looking at any of the available methods, or the examples.

Acknowledgements

All data is provided by data.police.uk under the Open Government Licence v3.0

About

a simple node.js wrapper around the UK police data API

Topics

Resources

Stars

8 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages