MaPit is our database and web service that maps postcodes and points to current or past administrative area information and polygons for all the United Kingdom. It has been rewritten from the ground up in GeoDjango and PostGIS, providing us with a large array of improvements including speed, a lovely admin interface, and much easier updating. The source code is available on GitHub.

Another notable benefit is that this new version has been filled with only totally open data, so you can be secure that you can reuse the data from this site under the minimal terms of the licences given below. It is based on OS OpenData Boundary-Line and Code-Point for Great Britain, and NSPD Open for Northern Ireland, with Super Output Areas from ONS. You can download raw copies of these datasets from our data mirror, which you can then use in your own copy of this service.

API

Non-commercial, low-volume use of this service is free. You will need to attribute OS/RM/ONS as per their licenses, and please do attribute us too :) For commercial or high-volume usage, please contact us about using the service, by licensing or by helping you install your own version.

All calls below are made to http://mapit.mysociety.org/ and return JSON (on some calls, stick .html on the end for an HTML version). By default, calls will return active areas; for some calls you may specify a previous generation to look up instead. The main difference in generation 12 is that it contains the pre-2010 England and Wales Parliamentary constituencies; generation 14 contains the pre-2011 Scottish Parliament constituencies. Only current Northern Ireland constituencies are present; if you need pre-2010 UK Parliament NI constituencies, or pre-2011 Northern Ireland Assembly constituencies, you can work it out from the wards and the 2003 SNAC file in the data/ directory. Whenever an area is returned from MaPit, it is as a dictionary with the following keys: id, name, country, type, parent_area, generation_low, generation_high, codes.

By postcode

Multiple areas

Generations

By point

An SRID is a unique number referring to a particular co-ordinate system; the ones you probably are interested in are 27700 for British National Grid, 4326 for WGS84 lon/lat, and 29902 for the Irish National Grid. You can restrict results to particular area types with a type parameter (multiple types separated by commas), and have results for a previous generation with a generation parameter. Note that x,y means longitude,latitude.

By area ID

All the following can take a type parameter to restrict results to a type or types: