-
Notifications
You must be signed in to change notification settings - Fork 1
/
Visualisation 3D.html
219 lines (197 loc) · 6.33 KB
/
Visualisation 3D.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>Visualisation 3D</title>
<link
rel="stylesheet"
href="https://js.arcgis.com/4.25/esri/themes/light/main.css"
/>
<link rel="shortcut icon" href="Image/georeserve.png" type="image/x-icon">
<script src="https://js.arcgis.com/4.25/"></script>
<script type="module" src="https://js.arcgis.com/calcite-components/1.0.0-beta.97/calcite.esm.js"></script>
<link rel="stylesheet" type="text/css" href="https://js.arcgis.com/calcite-components/1.0.0-beta.97/calcite.css" />
<link rel="stylesheet" href="https://js.arcgis.com/4.25/esri/themes/light/main.css" />
<script src="https://js.arcgis.com/4.25/"></script>
<link href="https://fonts.googleapis.com/css2?family=Crimson+Pro:wght@300&display=swap" rel="stylesheet">
<style>
html,
body,
#viewDiv {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
}
#affichage {
position: absolute;
width: 200px;
bottom: 40px;
left: 50%;
margin-left: -100px;
}
#titleDiv {
padding: 20px;
font-size: 18pt;
font-family: "Crimson Pro";
font-weight: bold;
text-align: center;
background-color: rgb(255, 255, 255, 1);
border-radius: 7px;
}
</style>
<script>
require([
"esri/config",
"esri/Map",
"esri/views/SceneView",
"esri/layers/FeatureLayer"
], function (esriConfig,Map, SceneView,FeatureLayer) {
esriConfig.apiKey = "AAPK22b2239330f348e6856b49ba92d3aa36l-qSfkzwWqJOSvuCHty6k4cDtOREFtSJoPiRlta-1uwftZL9sBYHbKzcDXjD4ZK5";
// Definition de la map MNT et imagerie sat
const map = new Map({
ground: "world-elevation",
basemap: "arcgis-imagery"
});
// Definition de la scene
const view = new SceneView({
container: "viewDiv",
map: map,
qualityProfile: "high",
camera: {
position: {
x: -7.93024019761322,
y: 31.162789688684672,
z: 4000
},
tilt: -90
}
});
//Definition du style du circuit(ligne)
const symbol_circuit = {
type: "simple",
symbol: {
color: "#f7230c",
type: "simple-line",
width: "2px",
style: "solid"
},
visualVariables: [
{
type: "size",
field: "ELEV_GAIN",
minDataValue: 0,
maxDataValue: 2300,
minSize: "3px",
maxSize: "7px"
}
]
};
//Definition du circuit(ligne)
const circuit = new FeatureLayer({
url: "https://services6.arcgis.com/f4ktY2fh4AlEsjcx/arcgis/rest/services/circuit/FeatureServer/0",
renderer: symbol_circuit,
opacity:80
});
map.add(circuit);
//Definition des étapes
const Etape = new FeatureLayer({
url: "https://services6.arcgis.com/f4ktY2fh4AlEsjcx/arcgis/rest/services/etape/FeatureServer/0",
elevationInfo: {
mode: "on-the-ground"
},
// Set a renderer that will show the points with icon symbols
renderer: {
type: "simple", // autocasts as new SimpleRenderer()
symbol: {
type: "point-3d", // autocasts as new PointSymbol3D()
symbolLayers: [
{
type: "icon", // autocasts as new IconSymbol3DLayer()
resource: {
primitive: "circle"
},
material: {
color: "black"
},
size: 4
}
]
}
},
outFields: ["*"],
// Ajout des étiquettes
labelingInfo: [
{
// autocasts as new LabelClass()
labelPlacement: "above-center", // When using callouts on labels, "above-center" is the only allowed position
labelExpressionInfo: {
expression: "$feature.NAME"
},
symbol: {
type: "label-3d", // autocasts as new LabelSymbol3D()
symbolLayers: [
{
type: "text", // autocasts as new TextSymbol3DLayer()
material: {
color: "black"
},
halo: {
color: [255, 255, 255, 0.7],
size: 2
},
font: {
family: "Crimson Pro",
weight: "bold"
},
size: 10
}
],
// Labels need a small vertical offset that will be used by the callout
verticalOffset: {
screenLength: 150,
maxWorldLength: 2000,
minWorldLength: 30
},
// The callout has to have a defined type (currently only line is possible)
// The size, the color and the border color can be customized
callout: {
type: "line", // autocasts as new LineCallout3D()
size: 0.5,
color: [0, 0, 0],
border: {
color: [0, 0, 0, 0]
}
}
}
}
]
});
map.add(Etape);
//Création d'un boutton
// Make the button toggle between top-down and bird eye's view
const button = document.getElementById("affichage");
button.addEventListener("click", () => {
if (button.innerHTML == "vue de dessus") {
button.innerHTML = "vue aérienne";
}
else {
button.innerHTML = "vue de dessus";
}
view.goTo(view.camera.tilt < 1 ? { tilt: 80 } : { tilt: 0 }).catch((error) => {
if (error.name !== "AbortError") {
console.error(error);
}
});
});
// Ajout du titre
view.ui.add("titleDiv", "top-right");
});
</script>
</head>
<body>
<div id="viewDiv"></div>
<calcite-button id="affichage">Toggle view</calcite-button>
<div id="titleDiv"> Circuit de Djbel Toubkal 4167 m </div>
</body>
</html>