Skip to content

Instantly share code, notes, and snippets.

@sebastian-meier
Created December 1, 2015 10:00
Show Gist options
  • Select an option

  • Save sebastian-meier/b38eb9a4df974a749d89 to your computer and use it in GitHub Desktop.

Select an option

Save sebastian-meier/b38eb9a4df974a749d89 to your computer and use it in GitHub Desktop.
MapboxGL.JS example
{
"version": 8,
"sources": {
"bezirke": {
"type": "vector",
"tiles": [
"http://YOURSERVER:10060/v2/tiles/{z}/{x}/{y}.pbf"
],
"minzoom": 0,
"maxzoom": 14
}
},
"layers": [{
"id": "background",
"type": "background",
"paint": {
"background-color": "#ddeeff"
}
},{
"id": "Bezirk",
"type": "line",
"source": "bezirke",
"source-layer": "Bezirk",
"layout": {
"line-join":"round"
},
"paint": {
"line-color": "red",
"line-width": 5,
"line-opacity": {
"stops": [[0,0],[1,0.1]]
}
}
}]
}
<!DOCTYPE html >
<html>
<head>
<meta charset='UTF-8'/>
<title>Mapbox GL JS rendering my own tiles</title>
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.10.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.10.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0 }
#map { position:absolute; top:0; bottom:0; height:100%; width:100%; }
</style>
</head>
<body>
<div id='map'>
</div>
<script>
mapboxgl.accessToken = 'NOT-REQUIRED-WITH-YOUR-VECTOR-TILES-DATA';
var map = new mapboxgl.Map({
container: 'map',
center: [13.4251364,52.5075419],
zoom: 12,
style: 'config.json'
});
map.rotateTo(45);
map.jumpTo({pitch: 90});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment