5
May
2020
9

Introducing our new copy and paste code Examples

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.

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 os.uk/developers.

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

You may also like

OS Data Hub to canvas: bring your favourite GB locations to life
Space, maps and the vulnerable – how integrated spatial data can help society
Meet the team: Alina Piotrowska
Building Passport – the story so far

2 Responses

  1. tony dyson

    Do you have an example of drawing a gpx file on an EPSG:27700 map using OpenLayers as I am failing to get that to work?
    It will display on an EPSG:3857 correctly.

    1. Jocelyn

      Tony, thanks for getting it contact. Please correct us if we’re wrong, but it seems you have also tweeted us. If so, we have replied via Twitter. Many thanks, Jocelyn

Leave a Reply

Your email address will not be published. Required fields are marked *

Name* :

Email* :

Website: