Skip to content

Comparing the past to the present with the new OS Maps API layers

28 Jul 2020
Ordnance Survey
Developers
0 comments
developershistoricmapsnational library of Scotland

As a Map Curator at the National Library of Scotland, Chris Fleet oversees the historical maps website https://maps.nls.uk. In this week’s #OSDeveloper blog, Chris offers us insight into his experience of the new OS Data Hub in the form of a guest blog…

We were keen to get our hands on the new OS Data Hub maps API layers when these were launched on 1 July. For the last ten years, the NLS has been happily using OS OpenData as a modern map layer in our maps website viewers, but the new OS Maps API layers have a number of advantages over these.

The benefits

First of all, the previous OS OpenData layers had to be downloaded and reprocessed in order to make them usable on our website. As we used four separate OS OpenData products at different scales – Miniscale, 1:250,000 colour raster, VectorMap District and Open Map Local – each needed to be downloaded processed separately, and then re-combined together as a web-ready tileset, to display properly at different zoom levels, so it always took a few days to do. In contrast, the new OS Maps API just involves a few lines of JavaScript to plug into – in ten minutes, you can get everything up and working (see ‘How to use the OS Maps API’ heading below).

A second, related advantage, is that we don’t need to worry about keeping the mapping up-to-date ourselves, as the live layer is pulled in dynamically from the OS servers. For the last few years since the Queensferry crossing over the Forth opened in 2017, our OS OpenData from 2015 didn’t even show the projected bridge, so its nice to see it really there now on the maps where we knew it was all along.

But perhaps the most important advantage is that the mapping itself is significantly improved in terms of styling and content. As users zoomed in and out with the previous separate OS OpenData products the contrast in styling when jumping between the layers was quite obvious, whereas now different zoom levels look and feel like a single integrated map. More important still, especially at larger scales, is the much richer topographic content. VectorMap District and Open Map Local had no contours, which in many of the hillier parts of the country, meant that the sense of topography and relief was very difficult to convey.

Comparing Open Map Local to the new OS Maps API for Ben Nevis
Comparing Open Map Local (left) to the new OS Maps API (right) for Ben Nevis. If you didn’t know already, the left-hand Open Map Local could almost have been a marshy flatland with a few rocks and streams thrown in, whereas the OS Maps API leaves you in no doubt of the impressive relief with its contours and shading. This image can be viewed via maps.nls.uk.

There are also a number of styling improvements to land use and text for features, so that things like parkland and woodland are easier to tell apart, more minor street names can be shown in urban areas, and different coloured lettering distinguishes things like schools, hospitals and churches from street names.

Comparing Open Map Local to the Light style from the new OS Maps API for central Edinburgh.
Comparing Open Map Local (left) to the Light style from the new OS Maps API (right) for central Edinburgh. Note the parkland and woods can now both be seen on the OS Maps API, and different coloured lettering distinguishes churches, cemeteries and gardens from street names. The light brown building infill is also quite subtle, playing down the man-made aspects of the landscape. View via maps.nls.uk.

Use of the OS Maps API on the NLS website

The National Library of Scotland currently makes available over a quarter of a million high-resolution images of historic maps through our website at https://maps.nls.uk. Whilst the focus is on Scotland, the map collection is international, and we have good online coverage of maps of England and Wales too, as well as scattered locations overseas.

We currently have just over 15% of our paper collection online, but we hope to expand this to 30% over the next five years, especially with more overseas mapping. As the NLS is a legal deposit library, we have been grateful to receive Ordnance Survey paper maps as they were published over the years, and these out-of-copyright historic OS maps are by far the most significant online category in terms of volume of maps and user interest.

Our map viewers fall into two main types: first, a couple of applications for finding and searching for maps, and second a suite of viewers for exploring georeferenced maps.

Our main application for searching for maps is the main Find by Place viewer, and we incorporated the OS Maps API Light Style into this as it displays as a set of shades of grey, ideal for backdrop mapping.

Searching for historic OS maps covering OS’s current headquarters using the NLS Find by Place viewer.
Searching for historic OS maps covering OS’s current headquarters using the NLS Find by Place viewer, displaying the OS Maps API Light style background mapping. The bounding boxes of historic OS six-inch to the mile maps are shown in red as an overlay, with the bounding boxes of the selected maps on the right shown in blue. View this map via maps.nls.uk.

Once georeferenced, historic maps can be easily compared to present-day map or satellite imagery in a number of ways. The most obvious of these is using an overlay with a transparency slider, but it is also possible to use a split-screen Side-by-side viewer, or to compare things through a Spy-glass viewer. As one of our users has said, “the viewers are a great way of wasting hours and hours…”. With them you can compare landscapes of a century or more ago with the present day, and research a wide variety of subjects: urban expansion, travel and communications, archaeology, woodland history, place names, or coastal erosion, to name just a few. These are best illustrated by some of the examples below.

Viewing urban expansion and change at Falmouth, Cornwall, using the OS Revised New Edition from 1905 with the OS Maps API.
Viewing urban expansion and change at Falmouth, Cornwall, using the OS Revised New Edition from 1905 (left) with the OS Maps API (right). The hachures on the right bring out the topography, but arguably make other features trickier to see. View this image and more at maps.nls.uk.
Comparing OS One-Inch New Popular mapping from 1947 with the OS Maps API for Kielder Water, Northumberland.
New reservoirs and expanding forestry – comparing OS one-inch New Popular mapping from 1947 (left) with the OS Maps API (right) for Kielder Water, Northumberland, allows us to see what used to lie under the water, including railways, roads, farms, and collieries. Find this map at maps.nls.uk.
Viewing coastal erosion at Mapleton, Yorkshire. The OS six-Inch to the mile mapping from 1908 compared to the OS Maps API.
Viewing coastal erosion at Mapleton, Yorkshire. The OS six-inch to the mile mapping from 1908 (left) compared to the OS Maps API (right) shows that the sea is now nearly 200 metres closer to the village compared to a century ago. Get a closer look at this mapping via maps.nls.uk.
Comparing the former rural landscape of Milton Keynes using the OS Revised New edition from 1904 with the OS Maps API.
What a difference a century makes! Comparing the former rural landscape of Milton Keynes using the OS Revised New edition from 1904 (left) with the OS Maps API (right). Find this map at maps.nls.uk.

Historic maps also provide an excellent way of studying cartography too: the contrasting colour schemes, symbolisation, and aesthetic qualities of particular map series. We can marvel at the skill, labour and expertise that went into the creation of these historic maps, as well as be inspired by their beauty and artistry.

Maps are never simple facsimiles of the landscape, but much more interesting and intelligent selections and omissions from the real world, a process that inevitably reflects aspects of the society that created them. These historic OS maps illustrate changing attitudes to open space, to transport and travel, to recreation, to the economy and politics, as well as to censorship over time. From this perspective, maps provide much more than a window into the landscape, whether we are looking at a paper map from the 1900s or at the OS Maps API today.

Comparing the OS one-inch to the mile, 3rd edition from 1920 with the OS Maps API for Melrose, Scottish Borders.
Comparing the OS one-inch to the mile, 3rd edition from 1920 (left) with the OS Maps API (right) for Melrose, Scottish Borders, shows the different combinations of hachures, contours and light-shading for depicting the Eildon Hills. The coloured 3rd edition was Ordnance Survey’s earliest attempt to produce a one-inch to the mile map with coloured topographic detail: water in blue, woodland in green, the first and second class roads in burnt sienna, hachures in brown, and contours in red. Find this map at maps.nls.uk.
The dramatic western end of the Ochil Hills, north of Stirling, seen on the OS half-inch to the Mile maps from 1908 and the OS Maps API.
The dramatic western end of the Ochil Hills, north of Stirling, seen on the OS half-inch to the Mile maps from 1908 (left) and the OS Maps API (right). The initial motivation behind the half-inch series was a military one, but it was recognised that it had a steadily growing public value particularly for cyclists and motorists. Take a look at this image via maps.nls.uk.

How to use the OS Maps API

Incorporating the OS Maps API into a web-mapping application is thankfully a very straightforward process, as there are example viewers online for the most popular web-mapping applications: Leaflet, OpenLayers, and the ArcGIS API for Javascript.

The relevant Javascript code can be copied and pasted, with minor adaptations, into other web-mapping applications. It is possible to access the OS Maps API layer using the OGC Web Map Tile Service (WMTS) standard, or as an XYZ layer, and use the default British National Grid projection (EPSG:27700) or the global Spherical Mercator (EPSG:3857) used by Google, OpenStreetMap or Bing.

For NLS, we used the XYZ layer in EPSG:3857, adding a minZoom: 7 parameter so that it would display at lower zoom levels. The OpenLayers v4 statement for the layer was therefore:

var OSMapsAPI = new ol.layer.Tile({
preload: Infinity,
title: ‘Background map – OS Maps API’,
mosaic_id: ‘8’,
source: new ol.source.XYZ({
attributions: [
new ol.Attribution({html: ‘Contains OS data © Crown copyright and database right 2020’})
],
url: ‘https://api.os.uk/maps/raster/v1/zxy/Outdoor_3857/{z}/{x}/{y}.png?key=’ + ‘[API key]’,
minZoom: 7
})
});

Try it for yourself

If you are interested in using OpenLayers for creating similar web-mapping viewers to the National Library of Scotland, we have been keen to share information on this. All the code behind our viewers is available on our Github pages, with notes and comments. We have written blogs and more detailed articles on our different viewers for finding and making available historic maps, as well as published online workshops on Using OpenLayers to put historical maps online.

For those interested in georeferenced maps, we have also recently written about how we create and maintain our large historic georeferenced map layers, and it is also possible to re-use some of our historic georeferenced map layers on other websites, using our free Historic Maps API, or the fee-based Historic Maps Subscription API.

Stay up to date with our #OSDeveloper content by signing up for our newsletter.

Working in the public sector? Find out how to sign up to the Public Sector Plan in the OS Data Hub and start using the APIs today.

 

Ordnance Survey
By Ordnance Survey
Press Office

Sharing the latest news about OS. We can licence you to use OS maps in print, online and film format. For more information and resources for journalists, bloggers and media professionals, email pressoffice@os.uk or call 023 8005 5565.