A Django app that lets you load Ordnance Survey data and use it to find places.
This is a Django app that lets you load Ordnance Survey data and use it to find places.
A list of Places from the Ordnance Survey is stored in a spatial database, and a url is provided to query them by name and return a JSON response containing matching places. Useful for autocompleting inputs that take town, city or road names.
In addition, the places are filtered by a series of bounding boxes, so that only places within the supplied boxes are returned.
- A GeoDjango (https://docs.djangoproject.com/en/dev/ref/contrib/gis/tutorial/#introduction) project (Note, this has only been tested with Django 1.4.5 and a PostGIS database)
- Add geocoder to your INSTALLED_APPS list in settings.py
- Import the geocoder ajax url into your project’s urls.py
- Set GEOCODER_BOUNDING_BOXES to include one or more bounding boxes
- Run python manage.py syncdb
- Restart your web server, if necessary.
The Ordnance Survey make large data sets available under an open license. See the url above for more details. This app uses the OS Locator and 1:50k Gazetteer.
- Download the data from the Ordnance Survey website.
- Set the GEOCODER_BOUNDING_BOXES entry in your settings.py.
- Import the data using one of the import management commands, the path to the data file is the only argument.
Anywhere you make use of the data from the OS you should display the following text:
> Contains Ordnance Survey data © Crown copyright and database right 2013
See the OS OpenData Licensing: http://www.ordnancesurvey.co.uk/oswebsite/opendata/licensing.html for more details.