Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

alphagov/mapit

 
 

Repository files navigation

MapIt

As of October 2022, Mapit is no longer used for location services within GDS - You should now use Locations API and/or Local Links Manager to provide the functionality that Mapit once provided.

This is a fork of the MapIt repo. MapIt is a Python/Django application (backed by PostgreSQL), that provides RESTful API for looking up postcodes, council boundaries, etc.

Avoid adding features, changing behaviours, or touching the code of MapIt itself. The only differences against the original repo should only be to help integrate it into the GOV.UK stack. So far this includes:

If we need to change the code itself, we should communicate with mysociety to try and push the work back upstream so everyone benefits.

Nomenclature

  • Area: a set of points that define an area that represents a geopolitical boundary of some sort. A country, a parliamentary constituency, a national park, a civil parish, etc.
  • Postcode: an identifier for a small geographical area usually derived from postal data. Postcodes don't have boundaries, instead they have a lat/lng point which is the centroid of their area. The Areas for that Postcode are looked up by doing a geo search for those that contain the point.
  • Generation: because areas change over time we add Areas to generations. If an area is in one generation but not another it is likely because legislation was enacted between those generations that meant it ceased to exist (often it is replaced by another similar but not exactly the same Area). Unless specified in the request mapit only searches in the current generation.
  • Type: to identify what an area is it has a type. For example European parliamentary constituencies are type 'EUR' compared to Westminister parliamentary constituencies of type 'WMC'.
  • CodeType: Areas have codes to allow them to be identified, issued by the ONS. Prior to 2011 these were SNAC codes (stored as type 'ons') (see: http://www.ons.gov.uk/ons/guide-method/geography/products/names--codes-and-look-ups/standard-names-and-codes/index.html), since 2011 these are GSS codes (stored as type 'gss') (see: http://neighbourhood.statistics.gov.uk/dissemination/Info.do?m=0&s=1460381709047&enc=1&page=nessgeography/new-geography-codes-and-naming-policy-from-1-january-2011.htm&nsjs=true&nsck=false&nssvg=false&nswid=1212)
  • ONSPD: The Office for National Statistics Postcode Database - one of the open data sources we use to import data. We get UK postcodes from this.
  • Boundary Line: The Ordnance Survey boundary line data - one of the open data sources we use to import data. We get GB Areas from this.
  • OSNI: The Ordnance Survey of Northern Ireland - one of the providers of the open data sources we use to import data. We get NI Areas from them.
  • ONS: Office for National Statistics
  • GSS: Government Statistical Service, new ONS codes - GSS codes start with a letter, and are 9 characters long e.g. S14000051
  • SNAC: old ONS codes - ONS codes consist of a number and/or character combination that could be 2, 4, 6, 8, or 10 characters long, and depending on the length, may only be numbers
  • SRID: spatial reference identifier

Technical documentation

You can use the GOV.UK Docker environment to run the application and its tests with all the necessary dependencies. Follow the usage instructions to get started.

Use GOV.UK Docker to run any commands that follow.

Running the application

To run management commands in other (non-development) environments, you'll need the GOVUK_ENV environment variable set.

Running the test suite

./manage.py test mapit mapit_gb

Further documentation

Licence

GNU Affero GPL

About

GOV.UK fork of Mapit, a web service to map postcodes to administrative boundaries

Topics

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 80.6%
  • HTML 12.5%
  • CSS 2.7%
  • SCSS 2.3%
  • Shell 1.9%