-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathol-eg.html
50 lines (44 loc) · 1.22 KB
/
ol-eg.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Using Watercolor Map Tiles with Open Layers</title>
<script src="https://cdn.jsdelivr.net/npm/ol@v7.5.1/dist/ol.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@v7.5.1/ol.css">
<style>
#map {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
}
</style>
</head>
<body>
<div id="map"></div>
</body>
<script>
const attributions =
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>';
const watercolor = new ol.source.XYZ({
attributions: attributions,
url: 'https://watercolormaps.collection.cooperhewitt.org/tile/watercolor/{z}/{x}/{y}.jpg',
maxZoom: 20,
crossOrigin: '',
});
const map = new ol.Map({
layers: [
new ol.layer.Tile({
source: watercolor,
}),
],
target: 'map',
view: new ol.View({
center: [0, 0],
zoom: 2,
}),
});
</script>
</html>