forked from allmaps/allmaps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
61 lines (55 loc) · 1.63 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>@allmaps/openlayers</title>
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/ol@v8.2.0/ol.css"
type="text/css"
/>
<link rel="stylesheet" href="examples/style.css" type="text/css" />
<script src="https://cdn.jsdelivr.net/npm/ol@v8.2.0/dist/ol.js"></script>
<script src="examples/controls.js"></script>
</head>
<body>
<div id="map"></div>
<div id="controls"></div>
<script type="module">
import { WarpedMapLayer } from './src/index.ts'
const warpedMapLayer = new WarpedMapLayer()
const map = new ol.Map({
target: 'map',
layers: [
new ol.layer.Tile({
source: new ol.source.OSM()
}),
warpedMapLayer
],
view: new ol.View({
center: ol.proj.fromLonLat([-71.00661, 42.37124]),
zoom: 14
})
})
warpedMapLayer.addGeoreferenceAnnotationByUrl(
'https://annotations.allmaps.org/maps/a9458d2f895dcdfb'
)
async function handleAddMapClicked() {
await warpedMapLayer.addGeoreferenceAnnotationByUrl(
'https://annotations.allmaps.org/maps/4d7b3c96d3e89c4f'
)
map.getView().fit(warpedMapLayer.getExtent(), {
padding: [25, 25, 25, 25]
})
}
if (window.initializeControls) {
initializeControls(
'examples/controls.html',
warpedMapLayer,
handleAddMapClicked
)
}
</script>
</body>
</html>