-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathopenlayers.html
More file actions
52 lines (51 loc) · 1.84 KB
/
openlayers.html
File metadata and controls
52 lines (51 loc) · 1.84 KB
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
<!DOCTYPE html>
<html>
<head>
<title>ostrava</title>
<meta http-equiv="imagetoolbar" content="no"/>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="apple-mobile-web-app-capable" content="yes">
<style type="text/css">
html, body { margin:0; padding: 0; height: 100%; width: 100%; }
body { width:100%; height:100%; background: #ffffff; }
#map { position: absolute; height: 100%; width: 100%; }
#slider { position: absolute; top: 10px; right: 10px; }
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.6.5/ol.css" type="text/css">
<script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL,fetch,Function.prototype.bind,es5&flags=always,gated&unknown=polyfill" type="text/javascript"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/ol3/4.6.5/ol.js" type="text/javascript"></script>
</head>
<body>
<div id="map"></div>
<input id="slider" type="range" min="0" max="1" step="0.1" value="1" oninput="layer.setOpacity(this.value)">
<script type="text/javascript">
var mapExtent = ol.proj.transformExtent([18.169168, 49.820551, 18.178271, 49.824675], 'EPSG:4326', 'EPSG:3857');
var mapMinZoom = 15;
var mapMaxZoom = 19;
var layer = new ol.layer.Tile({
extent: mapExtent,
source: new ol.source.XYZ({
attributions: [new ol.Attribution({html: 'ostrava; Rendered with <a href="https://www.maptiler.com/">MapTiler Desktop</a>'})],
url: "{z}/{x}/{y}.png",
tilePixelRatio: 1.000000,
minZoom: mapMinZoom,
maxZoom: mapMaxZoom
})
});
var osm = new ol.layer.Tile({
source: new ol.source.OSM()
});
var map = new ol.Map({
target: 'map',
layers: [
osm,
layer
],
view: new ol.View({
center: ol.proj.fromLonLat([18.173720, 49.822613]),
zoom: 16
})
});
</script>
</body>
</html>