OS API Examples
Helping you start building solutions with OS data
Here you'll find examples of our APIs in use. You can copy and paste the code to start building your own innovative projects.
These examples are related to the Mapping and Data APIs available from our Data Hub.
OS Maps API
These examples show you how to display a basic map, add zoom levels, change the style and restrict map panning to an area.
OS Vector Tile API
Display a basic map, apply a custom style and display 3D buildings.
OS Features API
Show features within map bounds, page through query results, show features which intersect a polygon, and let users 'find their nearest'.
This example requires a valid API key. If you have not already done so, please sign up to the Data Hub and acquire a project API key before copying-and-pasting the code below.
For further reading on the , refer to the technical specification.
This page is compatible with all modern browsers – including Chrome, Firefox, Safari and Edge.