-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
111 lines (82 loc) · 2.36 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="icon" href="img/arcgis-icon.jpg">
<title>ArcGIS</title>
<!-- THIS IS THE STYLESHEET OF THE MAP. -->
<link rel="stylesheet" href="https://js.arcgis.com/4.11/esri/css/main.css">
<!-- THE LIBRARIES OF JAVASCRIPT WE NEED WHEN USEING ARCGIS -->
<script src="https://js.arcgis.com/4.11/"></script>
</head>
<body>
<header>
<h1>Hello Using ArcGIS !</h1>
</header>
<br />
<button id="satellite"> Satellite Map </button>
<button id="streets"> Streets Map </button>
<button id="topo"> Topo Map </button>
<br /> <hr /> <br />
<div id="mapview" style="width:700px;height:500px"></div>
<script>
/* GLOBAL VARIABLES THAT UE CAN USE LATTER */
let map;
let map2;
let map3;
let mapview;
let lastcenter;
let lastzoom;
require(["esri/Map", "esri/views/SceneView", "esri/request"], function(Map, MapView, Request) {
map = new Map({ basemap: "topo"});
map2 = new Map({ basemap: "satellite"});
map3 = new Map({basemap: "streets"});
mapview = new MapView({
container: "mapview",
map: map,
center: [19.819025, 41.327953],
zoom: 11,
scale: 60000
});
});
document.getElementById('satellite').addEventListener("click", function() {
lastcenter = mapview.center;
lastzoom = mapview.zoom;
let p = new Promise(function(resolve, reject) {
mapview.map = map2;
resolve();
});
p.then(function() {
mapview.center = lastcenter;
mapview.zoom = lastzoom;
});
});
document.getElementById('streets').addEventListener("click", function() {
lastcenter = mapview.center;
lastzoom = mapview.zoom;
let p = new Promise(function(resolve, reject) {
mapview.map = map3;
resolve();
});
p.then(function() {
mapview.center = lastcenter;
mapview.zoom = lastzoom;
});
});
document.getElementById('topo').addEventListener("click", function() {
lastcenter = mapview.center;
lastzoom = mapview.zoom;
let p = new Promise(function(resolve, reject) {
mapview.map = map;
resolve();
});
p.then(function() {
mapview.center = lastcenter;
mapview.zoom = lastzoom;
});
});
</script>
</body>
</html>