File: index.html

package info (click to toggle)
tilemaker 3.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 78,284 kB
  • sloc: cpp: 28,715; ansic: 4,052; makefile: 180; ruby: 77; sh: 6
file content (54 lines) | stat: -rw-r--r-- 2,023 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
<!DOCTYPE html>
<html>
<head>
    <meta charset='utf-8' />
    <title>Tilemaker example server</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.50.0/mapbox-gl.js'></script>
    <link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.50.0/mapbox-gl.css' rel='stylesheet' />
	<script src='http://mapbox-gl-inspect.lukasmartinelli.ch/dist/mapbox-gl-inspect.min.js'></script>
	<link href='http://mapbox-gl-inspect.lukasmartinelli.ch/dist/mapbox-gl-inspect.css' rel='stylesheet' />
    <style>
        body { margin:0; padding:0; }
        #map { position:absolute; top:0; bottom:0; width:100%; }
		#refresh { position: absolute; top: 15px; left: 15px; background-color: white; padding: 5px; 
			border: 1px solid black; font-family: Avenir; cursor: pointer; }
    </style>
</head>
<body>

<div id='map'></div>
<!-- <div id='refresh' onclick='reload()'>Reload</div> -->
<script>
var map;

fetch("/metadata")
	.then(response => response.json())
	.then(data => {
		var styleURL = window.location.protocol+'//'+window.location.host+'/style.json';
		var bounds = data['bounds'].split(',');
		map = new mapboxgl.Map({
		    container: 'map', // container id
		    style: styleURL, // stylesheet location
		    center: [(Number(bounds[0])+Number(bounds[2]))/2,
			         (Number(bounds[1])+Number(bounds[3]))/2], // starting position [lng, lat]
		    zoom: 13 // starting zoom
		});
		map.addControl(new mapboxgl.NavigationControl());
		map.addControl(new mapboxgl.AttributionControl({ compact: false, customAttribution:
			"Style © <a href='http://openmaptiles.org/'>OpenMapTiles</a> | "+
			"Data © <a href='http://www.openstreetmap.org/copyright'>OpenStreetMap contributors</a>" }));

		// -- Comment the following lines out to remove debug UI --
		map.showTileBoundaries=true;
		map.addControl(new MapboxInspect({
		  showInspectButton: false,
		  showMapPopup: true
		}));
		// -- --
	}
)
</script>

</body>
</html>