14th March 2013

Code used to build map-based search tool released as open source

Luke Hampson

Over the last couple of years Ordnance Survey has been working on a collaborative project with UK Location Programme and Cabinet Office to implement map-based tools, making it easier for users to search and preview public location datasets available on data.gov.uk. The project was completed to further enable the publication of location datasets in support of the UK Location Strategy, and as part of the UK contribution to the European INSPIRE project.

We are now pleased to announce that the code developed by Ordnance Survey for these mapping tools has been released as open source.

The Map Based Search (see image below) allows users to draw a box on a background map, leading to a search for datasets which are wholly or partially contained in that area. It also features a gazetteer, so the user can locate by place name where on the map they want to draw their search box. This provide a richer, more advanced way of searching, at national, regional and local level, for records of data sets and services that are referenced by geographical coordinates.

Map based search image

The Map Preview (see image below) allows the user to display geospatial data as a previewed sample on a map. The data being previewed must be published using a Web Map Service (WMS), a widely used protocol for serving geo-referenced map images from distributed databases.

map preview

Along with all the code for the data.gov.uk site, the code used to develop the map-based search tools has now been released by Ordnance Survey as open source. The code is mostly written in Javascript, and uses OpenLayers. It is integrated into the CKAN extension ‘ckanext-os’, available here: httpss://github.com/datagovuk/ckanext-os and offered for reuse under the new BSD license.

Whilst the code is open, these tools require access to web map services and gazetteer services to operate. We supply commercial-grade versions of these services to data.gov.uk under licence, but other websites that wish to use this software can obtain their own licence from us, or substitute free alternatives, such as services based on our own OS OpenData or through OpenStreetMap.