-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
77 lines (65 loc) · 1.96 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
74
75
76
77
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no" />
<title>Arctic Maps Layers</title>
<style>
html,
body,
#viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.20/esri/themes/light/main.css">
<script src="https://js.arcgis.com/4.20/"></script>
<script>
require(["esri/config", "esri/WebMap", "esri/views/MapView", "esri/widgets/ScaleBar", "esri/widgets/Legend", "esri/widgets/LayerList"], function(esriConfig, WebMap, MapView, ScaleBar, Legend, LayerList) {
esriConfig.apiKey = "AAPKc758424f9fd4486d9134df747a57c2fdrq8MzZy9VHqbfPzXNut5SvvoABhJdzImRZOvLbw3qin0_dz9IeNBEOADq9Up7hyG";
const webmap = new WebMap({
portalItem: {
id: "459a15cb00374d9b81961fcba02b2dd4"
}
});
const view = new MapView({
map: webmap,
center: [0, 90],
zoom: 4, // scale: 72223.819286
container: "viewDiv" // Div element
});
const scalebar = new ScaleBar({
view: view
});
view.ui.add(scalebar, "bottom-left");
// const legend = new Legend({
// view: view
// });
// view.ui.add(legend, "top-right");
// Add a legend instance to the panel of a
// ListItem in a LayerList instance
const layerList = new LayerList({
view: view,
listItemCreatedFunction: function(event) {
const item = event.item;
if (item.layer.type != "group") {
// don't show legend twice
item.panel = {
content: "legend",
open: true,
};
}
}
});
layerList.visibleElements = {
statusIndicators: false
};
view.ui.add(layerList, "top-right");
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>