-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCarte des superficies.html
323 lines (272 loc) · 10.1 KB
/
Carte des superficies.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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<!DOCTYPE html>
<html lang="en"><!-- Basic -->
<head>
<base target="_top">
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- Mobile Metas -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Site Metas -->
<title>Géoportail Des Parcs Nationaux</title>
<meta name="keywords" content="">
<meta name="description" content="">
<meta name="author" content="">
<!-- Site Icons -->
<link rel="shortcut icon" href="Image/georeserve.png" >
<link rel="apple-touch-icon" href="Image/">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="Css/bootstrap.min.css">
<!-- Site CSS -->
<link rel="stylesheet" href="Css/style.css">
<!-- Pickadate CSS -->
<link rel="stylesheet" href="Css/classic.css">
<link rel="stylesheet" href="Css/classic.date.css">
<link rel="stylesheet" href="Css/classic.time.css">
<!-- Responsive CSS -->
<link rel="stylesheet" href="Css/responsive.css">
<!-- Custom CSS -->
<link rel="stylesheet" href="Css/custom.css">
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<!-- Load jQuery and PapaParse to read data from a CSV file -->
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/papaparse.min.js"></script>
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/leaflet.css"/>
<script src="https://unpkg.com/[email protected]/dist/leaflet.js"></script>
<script src="https://code.jquery.com/jquery-3.5.1.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/[email protected]/papaparse.min.js"></script>
<title>Layers Control Tutorial - Leaflet</title>
<link rel="shortcut icon" href="Image/georeserve.png" type="image/x-icon">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"/>
<link rel="stylesheet" href="Css/leaflet.css"/>
<script src="Js/leaflet.js"></script>
<link rel="stylesheet" href="Css/leaflet.zoomhome.css"/>
<script src="Js/leaflet.zoomhome.min.js"></script>
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
<script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body>
<!-- Start header -->
<header class="top-navbar">
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container">
<a class="navbar-brand" href="index.html">
<img src="images/logogeotourisme.png" alt="" />
</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbars-rs-food" aria-controls="navbars-rs-food" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbars-rs-food">
<ul class="navbar-nav ml-auto">
<li class="nav-item"><a class="nav-link" href="index.html">Accueil</a></li>
<li class="nav-item"><a class="nav-link" href="about.html">Informations</a></li>
<li class="nav-item"><a class="nav-link" href="storymap\index1.html" target="_blank">Géoportail</a> </li>
<li class="nav-item active dropdown">
<a class="nav-link dropdown-toggle" href="#" id="dropdown-a" data-toggle="dropdown">Cartes thématiques</a>
<div class="dropdown-menu" aria-labelledby="dropdown-a">
<a class="dropdown-item" href="Carte des superficies.html">Carte des superficies</a>
<a class="dropdown-item" href="Carte NDVI.html">Carte NDVI</a>
<a class="dropdown-item" href="Visualisation 3D.html" target="_blank">Visualisation 3D</a>
</div>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" id="dropdown-a" data-toggle="dropdown">Recherche</a>
<div class="dropdown-menu" aria-labelledby="dropdown-a">
<a class="dropdown-item" href="Recherche.html">Attributaires</a>
<a class="dropdown-item" href="Recherche2.html">Spatiales</a>
<a class="dropdown-item" href="Itinéraire.html">Itinéraire</a>
</div>
</li>
<li class="nav-item"><a class="nav-link" href="contact.html">Contact</a></li>
</ul>
</div>
</div>
</nav>
</header>
<!-- End header -->
<!-- Start All Pages -->
<div class="all-page-title page-breadcrumb">
<div class="container text-center">
<div class="row">
<div class="col-lg-12">
<h1>Carte des superficies</h1>
</div>
</div>
</div>
</div>
<!-- End All Pages -->
<div class="blog-box">
<div class="container">
<div class="row">
<div class="col-lg-12">
<div class="heading-title text-center">
<br>
<h2>Carte représentant les superficies des parcs nationaux</h2>
<br>
<head>
<style>
html, body {
height: 100%;
width: 100%;
margin: 0;
}
.info {
padding: 6px 8px;
font: 14px/16px Arial, Helvetica, sans-serif;
background: white;
background: rgba(255,255,255,0.8);
box-shadow: 0 0 15px rgba(0,0,0,0.2);
border-radius: 5px;
}
.info h4 {
margin: 0 0 5px;
color: #777;
}
.legend {
line-height: 18px;
color: #555;
}
.legend i {
width: 18px;
height: 18px;
float: left;
margin-right: 8px;
opacity: 0.7;
}
#map{
height: 500px ;
width: 1000px;
display: block;
margin-left: auto;
margin-right: auto;
padding: 100px;
font-size: 20px;
}
</style>
</head>
<body>
<div id="map" class="map" ></div>
<script type="text/javascript" src="Parc_Geojson/Parc_Nationaux.geojson"> </script>
<script type="text/javascript" src="Parc_Geojson/morocco.geojson"> </script>
<script type="text/javascript">
//L'ajout de basemap et de la couche des parcs nationaux
const map = L.map('map',{zoomControl: false}).setView([29.638933, -9.665423], 5);
const tiles = L.tileLayer('https://tile.openstreetmap.org/{z}/{x}/{y}.png', {
maxZoom: 19,
attribution: '© <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>'
}).addTo(map);
var myStyle = {
"color": "Black",
"weight": 5,
"opacity": 1,
"fill":"Black",
};
L.geoJson(morocco,{
style: myStyle
}).addTo(map);
L.geoJson(Parc_Nationaux).addTo(map);
// Creation d'une fonction de couleur
function getColor(i) {
return i > 1231 ? '#a50f15' :
i > 581 ? '#de2d26' :
i > 381 ? '#fb6a4a' :
i > 138 ? '#fcae91' :
'#FEE5D9';
}
//Creation d'une fonction style
function style(feature) {
return {
fillColor: getColor(feature.properties.Superficie),
weight: 2,
opacity: 1,
color: 'black',
dashArray: '1',
fillOpacity: 0.7
};
}
L.geoJson(Parc_Nationaux, {style: style}).addTo(map);
// Interaction
function highlightFeature(e) {
var layer = e.target;
layer.setStyle({
weight: 5,
color: '#666',
dashArray: '',
fillOpacity: 0.7
});
layer.bringToFront();
info.update(layer.feature.properties);
}
function resetHighlight(e) {
geojson.resetStyle(e.target);
info.update();
}
var geojson;
// ... our listeners
geojson = L.geoJson(Parc_Nationaux);
function zoomToFeature(e) {
map.fitBounds(e.target.getBounds());
}
function onEachFeature(feature, layer) {
layer.on({
mouseover: highlightFeature,
mouseout: resetHighlight,
click: zoomToFeature
});
}
geojson = L.geoJson(Parc_Nationaux, {
style: style,
onEachFeature: onEachFeature
}).addTo(map);
//Affichage des informations
var info = L.control();
info.onAdd = function (map) {
this._div = L.DomUtil.create('div', 'info'); // create a div with a class "info"
this.update();
return this._div;
};
// method that we will use to update the control based on feature properties passed
info.update = function (props) {
this._div.innerHTML = '<h4> <i>Superficie des parcs nationaux</i> </h4>' + (props ?
'<b>' + props.Nom + '</b><br />' + props.Superficie + 'km²'
: 'Passer la souris sur un parc national');
};
info.addTo(map);
//Definition d'une légende
var legend = L.control({position: 'bottomright'});
legend.onAdd = function (map) {
var div = L.DomUtil.create('div', 'info legend'),
grades = [100,138, 381, 581, 1231],
labels = [];
div.innerHTML += '<h6>Légende</h6>';
for (var i = 0; i < grades.length; i++) {
div.innerHTML +=
'<i style="background:' + getColor((grades[i] + 1) ) + '"></i> ' +
grades[i] + (grades[i + 1] ? '-' + grades[i + 1] + 'km² <br>' : '+');
}
return div;
};
legend.addTo(map);
var zoomHome = L.Control.zoomHome();
zoomHome.addTo(map);
</script>
<!-- ALL JS FILES -->
<script src="Js/jquery-3.2.1.min.js"></script>
<script src="Js/popper.min.js"></script>
<script src="Js/bootstrap.min.js"></script>
<!-- ALL PLUGINS -->
<script src="Js/jquery.superslides.min.js"></script>
<script src="Js/images-loded.min.js"></script>
<script src="Js/isotope.min.js"></script>
<script src="Js/picker.js"></script>
<script src="Js/picker.date.js"></script>
<script src="Js/picker.time.js"></script>
<script src="Js/legacy.js"></script>
<script src="Js/form-validator.min.js"></script>
<script src="Js/contact-form-script.js"></script>
<script src="Js/custom.js"></script>
<a href="#" id="back-to-top" title="Back to top" style="display: none;">↑</a>
</body>
</html>