Runette Software Blog


This post is probably of extremely niche interest :) But if you need it, you need it.

The Ordnance Survey (of the UK) had an open-access API called OpenSpace as part of the Open Government initiative.

That API is now closed to new users and has been replaced by a new, vector-tile based API. However, the API is still in use for applications that were registered before about Sept 2019 and they have not announced end-of-life yet - it will be difficult given that maps provided by the new API are totally different to the old maps and the change is a big, breaking change.

One of the problems with the OpenSpace API was the official support for OpenLayers only supported v2. I needed to update an OpenSpace based application to OpenLayers v6 (latest version) and this is the details of how I did that.

OpenLayers Versions

OpenLayers v2 is a very old version and there was a major rewrite from v2 to v3 that changed fundamentally the structure of the API - which is probably why the OS never migrated.

Luckily, there was a community-supported port to V3 that was very good - openspace-ol3.

However - there have been some changes since v3 that stopped this port working.


The complete code is shown in the following gist. The major changes from openspace-ol3 are around the imports and around the details in the hack to fix the resolution called on the API - where the mechanisms to call the API have changed.

Gist - 1: