Query for UK postcodes and geolocations over HTTP. Postcodes.io uses the Office for National Statistics Postcode Directory.
Documentation can be found at postcodes.io
Please make sure you have the following available:
- Node.js v4.x (Instructions)
- Postgres with PostGIS extension (Instructions)
We also have an end-to-end guide to install Postcodes.io on a fresh virtual machine in the wiki.
Download and install
$ git clone https://github.com/ideal-postcodes/postcodes.io.git
$ cd postcodes.io/ && npm install
Configure Postgres and Seed Database
Postcodes.io is packaged with a script to setup and download the ONS Postcode Directory. To run this, navigate into the repository directory and run,
$ npm run setup
This script will prompt you for Postgres superuser credentials. This privilege is required to create a new user, database, extensions and then to load the data. For the security conscious, you can find out how this works by reading our installation notes and the script itself. Other install methods are available but require a bit of extra work.
You can change the Postgres username/password yourself but you will need to update 'config/config.js' with the relevant credentials.
The import process takes around 10 minutes to complete.
Run it
node server.js // Default environment is development
$ npm run setup_test_db # create test database
$ npm test
Any changes, including backwards incompatible changes will be listed here
3.0.2 Updated latest pg_dump for Aug 2016 ONSPD
3.0.1 Added some missing GSS codes. Fix import script for Aug 2016 ONSPD
3.0.0 Drop support for node.js 0.10 and 0.12
2.0.1 Expanded accept headers and HTTP methods in CORS preflight requests
2.0.0 Updated dataset to February 2016
##External Libraries
-
[Java Library] (https://github.com/spdeepak/postcodes-io-java) by Deepak Sunanda Prabhakar
-
PHP Libraries
- [postcodes-io-bundle] (https://github.com/boxuk/postcodes-io-bundle) by the people at [Box UK] (https://www.boxuk.com/). Read the [Blog post] (https://www.boxuk.com/insight/tech-posts/geocoding-postcodes-symfony2)
- [postcodes-io laravel] (https://github.com/adityamenon/postcodes-io-laravel) package by [Aditya Menon] (http://adityamenon.co)
- [PHP Class for Postcodes.io] (https://github.com/hart1994/Postcodes-IO-PHP) by [Ryan] (https://github.com/hart1994/)
- [postcodes-io-bundle] (https://github.com/boxuk/postcodes-io-bundle) by the people at [Box UK] (https://www.boxuk.com/). Read the [Blog post] (https://www.boxuk.com/insight/tech-posts/geocoding-postcodes-symfony2)
-
[Ruby Library] (postcodes_io) by [James Ruston] (https://github.com/jamesruston)
-
[Node.JS Library] (https://github.com/cuvva/postcodesio-client-node) by [billinghamj] (https://github.com/billinghamj)
-
[Python Library] (https://github.com/previousdeveloper/PythonPostcodesWrapper) by [Gokhan Karadas] (https://github.com/previousdeveloper)
-
[C# Library] (https://github.com/markembling/MarkEmbling.PostcodesIO) by [Mark Embling] (https://github.com/markembling)
-
[R Library] (https://github.com/erzk/PostcodesioR) by [Eryk Walczak] (http://walczak.org). Read the [blog post] (http://walczak.org/2016/07/postcode-and-geolocation-api-for-the-uk/).
-
[Google Sheets Addon] (https://chrome.google.com/webstore/detail/uk-postcode-geocoder/bjkecdilmiedfkihpgfhfikchkghliia?utm_source=permalink) by [Ed Patrick] (http://edwebdeveloper.com/)
MIT