Skip to content

Introducing our new copy and paste code Examples

5 May 2020
Ordnance Survey

Update: 1 July 2020, OS APIs now live and available via our OS Data Hub, sign up here.

To help you get started quickly with our APIs, we’ve been working on technical resources that go beyond documentation. This post introduces a key component of that – our new set of copy and paste code examples.

By copying and pasting the code from our new Examples you could have your first mapping application on your web page in just minutes. Examples range from adding a basic map, to extruding 3D buildings, to finding your nearest greenspace.

Data extract using copy and paste code examples

Showcasing the functionality of our Mapping and Data APIs, we’ve based our examples on well-understood, common usage patterns. They’ll help you get started and even stimulate ideas, giving you inspiration for new features to build into your own applications.

At the top of each example you’ll see an interactive map showing the functionality in action – you even have the option to view it in full-screen. We’ve made the examples using common web map libraries (where the functionality exists); Mapbox GL JS, Leaflet, OpenLayers and ArcGIS API for JavaScript. We’ve included a drop-down to select the library of your choice and then you can copy the code, add your own API Key and start using it. Use them as they are or customise to make them your own.

We’ll add new examples as required and keep the code libraries updated in-line with new versions.

Screen recording - copy and paste code example

We’ll also be writing more Tutorials which show how to bring the pieces of functionality together to build a functional application. Our tutorials will shine the spotlight on different software options, including those used in common data science pipelines. Check out this which explores various options for integrating OS data into your analysis.

Start using our Examples

To get started, go to our OS Data Hub, sign up, add a project and grab an API Key. Then head over to our Examples page, find the one you want, select your mapping library of choice, copy the code, paste, add your key and off you go!

The APIs are launching this July, but you can sign up now to trial them. Through the APIs you will have free unlimited access to OS OpenData to use for personal, or commercial reasons; and free access to OS premium data, including OS MasterMap, up to a value of £1,000 a month for developing apps, products and services for use by third parties.

If you’re a developer working in the public sector and the organisation is a member of the Public Sector Geospatial Agreement (PSGA), you will have free access to all of the APIs under the PSGA terms from early 2021.

Find out more about the Data Hub and our APIs by visiting our dedicated developer website

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

Ordnance Survey
By Ordnance Survey
Press Office

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