2016-05-11 16:08:37 +00:00
---
layout: page
title: Getting Started
published: true
---
# Getting Started
2016-05-14 12:31:33 +00:00
In this tutorial you will learn how to serve vector tiles from a MBTiles file and how to display them in your browser.
2016-05-11 16:08:37 +00:00
## Serve Vector Tiles
2016-05-14 12:31:33 +00:00
In order to render your map with Mapbox GL JS you need install a simple tileserver
that supports serving vector tiles.
2016-05-11 16:08:37 +00:00
2016-05-14 12:31:33 +00:00
```bash
2016-05-23 13:24:39 +00:00
npm install -g tileserver-gl-light
2016-05-14 12:31:33 +00:00
```
2016-05-23 13:24:39 +00:00
Head over to the [Downloads ](/downloads/ ) section and choose your country or city extract or even the entire planet as the vector tiles you want to serve.
2016-05-14 12:31:33 +00:00
The vector tiles are stored in the MBTiles SQLite database you downloaded now.
2016-05-12 09:12:52 +00:00
```bash
2016-05-23 13:24:39 +00:00
curl -o zurich.mbtiles https://osm2vectortiles-downloads.os.zhdk.cloud.switch.ch/v2.0/extracts/zurich_switzerland.mbtiles
2016-05-12 09:12:52 +00:00
```
2016-05-11 16:08:37 +00:00
2016-05-23 13:24:39 +00:00
Start the tileserver in the same directory.
2016-05-14 12:31:33 +00:00
```bash
2016-05-23 13:24:39 +00:00
tileserver-gl-light
2016-05-14 12:31:33 +00:00
```
2016-05-11 16:08:37 +00:00
## Display a map in your browser
2016-05-23 13:24:39 +00:00
If you visit `localhost:8080` you will see an overview of predefined styles you can already use. You can now choose a map and copy the example full-screen HTML code from below. Put the HTML code into a `index.html` and open it with your browser.
2016-05-11 16:38:49 +00:00
2016-05-23 13:24:39 +00:00
Congratulations, you are now serving your own vector tiles and your own map!
You can now [create your own custom Mapbox GL style with Mapbox Studio ](/docs/create-map-with-mapbox-studio/ ).
2016-05-11 16:38:49 +00:00
2016-05-23 13:24:39 +00:00
< img src = "/media/tileserver-gl-light.png" align = "center" style = "max-width:600px" alt = "Index page of tileserver-gl-light" / >