Reverse-geocode lat,lng to UK postcodes, using Ordnance Survey OpenData and PostGIS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
lib
script
views
.gitignore
Gemfile
Gemfile.lock
README.md
config.ru
geopostcoder.rb

README.md

GeoPostCoder

Loading Code-Point Open data into your database

First order and download the Code Point Open files from the Ordnance Survey and unpack them locally. You should get a Data/CSV directory containing a file for each postcode prefix. In total there were about 1.68 million rows (Q1 2013).

Create your database and install PostGIS extensions (assuming Postgres 9.1+, PostGIS 2+, and sufficient DB privileges).

$ createdb geopostcoder
$ psql -c "CREATE EXTENSION postgis" geopostcoder

Then you can load the Code-Point Open data into your db:

$ cat /cpo-download/Data/CSV/*.csv | script/load_code_point_open -d <database>

Running a local server

copy config/database.yml.example to config/database.yml, and edit it to match your database name

Install the necessary gems by running bundle install, then start the server with thin start.

Point your browser at http://localhost:3000, and try out reverse geocoding some latitudes and longitudes to UK postcodes.

License

GeoPostCoder is released under the MIT License.