-
Notifications
You must be signed in to change notification settings - Fork 4
/
index_expand.html
76 lines (66 loc) · 1.57 KB
/
index_expand.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
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no">
<title>2D Map</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.11/esri/css/main.css">
<script src="https://js.arcgis.com/4.11/"></script>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
}
</style>
<script>
require([
"esri/views/MapView",
"esri/WebMap",
"esri/widgets/Search",
"esri/widgets/Legend",
"esri/widgets/BasemapGallery",
"esri/widgets/Expand",
"dojo/domReady!"
], function(MapView, WebMap, Search, Legend, BasemapGallery, Expand) {
var map = new WebMap({
portalItem: { // autocasts as new PortalItem
id: "7d281311aef74b5fa2c39f0ebc01b5dd"
}
});
var view = new MapView({
container: "viewDiv",
map: map
});
var searchWidget = new Search({
view: view
});
view.ui.add(searchWidget, {
position: "top-right",
});
var legend = new Expand ({
content: new Legend({
view: view,
}),
view: view,
expanded: true
});
view.ui.add(legend, "bottom-left");
var basemapGallery = new Expand ({
content: new BasemapGallery({
view: view,
}),
view: view,
expanded: false
});
// Add the widget to the top-right corner of the view
view.ui.add(basemapGallery, {
position: "top-right"
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>