-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
73 lines (65 loc) · 1.94 KB
/
index.html
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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Mapbox GL</title>
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.52.0/mapbox-gl.css' rel='stylesheet' />
<style>
html, body, #map {
height: 100%;
width: 100%;
padding: 0;
margin: 0;
}
</style>
</head>
<body>
<div id="map" class="map"></div>
</body>
<script>
mapboxgl.accessToken = '';//fill mapbox token here
var map = new mapboxgl.Map({
container: 'map',
style: 'mapbox://styles/mapbox/streets-v9',
center: [37.61, 55.7],
zoom: 8
});
map.on('load', function() {
map.addLayer({
"id": "grnicy_ao_w1251_id",
"type": "fill",
"source": {
"type": "vector",
"scheme": "tms",
"tiles": ["http://194.58.104.84:8080/geoserver/gwc/service/tms/1.0.0/test:grnicy_ao_w1251@EPSG%3A900913@pbf/{z}/{x}/{y}.pbf"],
"minzoom": 0,
"maxzoom": 14
},
"source-layer": "grnicy_ao_w1251",
"paint": {
"fill-opacity": 0.6,
"fill-color": "rgb(53, 175, 109)",
'fill-outline-color': 'white'
}
});
});
map.on('click', 'grnicy_ao_w1251_id', function (e) {
new mapboxgl.Popup()
.setLngLat(e.lngLat)
.setHTML(e.features[0].properties.county_nam)
.addTo(map);
});
map.on('mouseenter', 'grnicy_ao_w1251_id', function () {
map.getCanvas().style.cursor = 'pointer';
});
map.on('mouseleave', 'grnicy_ao_w1251_id', function () {
map.getCanvas().style.cursor = '';
});
map.addControl(new mapboxgl.NavigationControl());
map.addControl(new mapboxgl.ScaleControl());
map.addControl(new mapboxgl.FullscreenControl());
</script>
</html>