OpenMapTiles.org gives an example snippet (which is described as) showing how to use Mapbox GL JS to display openmaptiles generated tiles.
The full OMT example:
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title>OpenMapTiles OSM Bright style</title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.29.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.29.0/mapbox-gl.css' rel='stylesheet' />
<style>
body { margin:0; padding:0; }
#map { position:absolute; top:0; bottom:0; width:100%; }
</style>
</head>
<body>
<div id='map'></div>
<script>
var map = new mapboxgl.Map({
container: 'map',
style: 'https://openmaptiles.github.io/osm-bright-gl-style/style-cdn.json',
center: [8.5456, 47.3739],
zoom: 11
});
</script>
</body>
</html>
I serve it from an nginx server and it does indeed work.
The path to the tiles is fairly deep however:
https://openmaptiles.github.io/osm-bright-gl-style/style-cdn.json
...
sources:
openmaptiles:
type: "vector"
url: "https://free.tilehosting.com/data/v3.json?key=RiS4gsgZPZqeeMlIyxFo"
...
https://free.tilehosting.com/data/v3.json?key=RiS4gsgZPZqeeMlIyxFo
tiles:
0:"https://maps.tilehosting.com/data/v3/{z}/{x}/{y}.pbf.pict?key=RiS4gsgZPZqeeMlIyxFo"
I have two questions:
- The above final tile endpoint
https://maps.tilehosting.com/data/v3/{z}/{x}/{y}.pbf.pict
appears from the suffix.pict
not be a vector format. Is that correct? Is there another example using the vector format produced by the tools in openmaptiles git repo? - Is the chain of files leading to the tiles endpoint all open software, or is some of it proprietary?