# Create a web application using the OS Vector Tile API

This guide explains how to create a web application using the OS Vector Tile API and the Ordnance Survey GitHub Demo repository.

## What you need?

* Basic web development skills
* Access to an IDE
* Access to the [OS Data Hub API Demos](https://github.com/OrdnanceSurvey/OS-Data-Hub-API-Demos) GitHub repository
* OS Vector Tiles API Project Key; see [getting-started-with-an-api-project](https://docs.os.uk/os-apis/core-concepts/getting-started-with-an-api-project "mention") for more information

## Instructions

{% stepper %}
{% step %}
**Download the OS Vector Tile API repository**

* Open the [OS Data Hub API Demos](https://github.com/OrdnanceSurvey/OS-Data-Hub-API-Demos) repository on GitHub.

<figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-c29fa454182ac67b7290ff22447d08f812cd7ebf%2FFigure1.png?alt=media" alt="OS Data Hub API Demos repository on GitHub"><figcaption></figcaption></figure>

* Click the green *Code* button and then click *Download ZIP*.

<figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-d4886392c54b7a9f1bd7df9bf26a790671f796c9%2FFigure2.png?alt=media" alt="OS Data Hub API Demos repository Code > Download ZIP option"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Install the OS Vector Tile API repository**

* Navigate to your downloads page, unzip the `OSVectorTileAPI` folder from the newly downloaded file and place it in your IDE project repository. When you open your IDE, the new files should appear automatically in your project window. The folders you have installed contain all the code required to call and interact with the code libraries.

<figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-b9af262fdd18818296380cfdcbe158e83301fc5d%2FVTS-WebApp-3.png?alt=media" alt="UnzippedOSVectorTileAPI folders"><figcaption></figcaption></figure>

* To launch the web application, navigate to and open the `index.html` file found in the `OpenLayers` folder, and then run the application. Methods on how to do this differ between IDEs.

<figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-9a8a10acefb9aa242c5e69167c639cbac30110ba%2FVTS-WebApp-5.png?alt=media" alt="OS VTS API in Aptana Studio 3"><figcaption></figcaption></figure>

Running the project launches a window in your browser that looks like this:

<figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-9644c9a8e1a37f99075c351dba8deda9d3682a05%2FVTS-WebApp-6.png?alt=media" alt="OS Vector Tile API demonstrator displayed in a browser window"><figcaption></figcaption></figure>
{% endstep %}

{% step %}
**Using the OS Vector Tile API demo**

To use the demo, open up your *My projects* page on the OS Data Hub and copy your *Project API Key*. Paste the key into the Project API Key box on the local server demo.

\_This generates a fully-styled map using the OS Vector Tile API service available for you to explore.

<figure><img src="https://4043944746-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEzqrBzRGoJw7nQyLj1W%2Fuploads%2Fgit-blob-f2557829f02995cc783d4c459c6db26c4a36ad1a%2FVTS-WebApp-8.png?alt=media" alt="OS Vector Tile API demonstrator displaying an example map"><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}
