-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.html
203 lines (182 loc) · 7.97 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
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
<!-- Kaynak : https://data.ibb.gov.tr/dataset/deprem-senaryosu-analiz-sonuclari/resource/9c3ac492-de4b-4245-b418-7ad3df67a193 -->
<head>
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="pragma" content="no-cache">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="Deprem Yardımlaşma Haritası">
<link rel="stylesheet" href="leaflet/leaflet.css" />
<link rel="stylesheet" href="leaflet/dist/MarkerCluster.css" />
<link rel="stylesheet" href="leaflet/dist/MarkerCluster.Default.css" />
<script src="leaflet/leaflet.js"></script>
<script src="leaflet/jquery-3.6.3.min.js"></script>
<script src="leaflet/dist/leaflet.markercluster.js"></script>
<title>Istanbul Deprem Simülasyonu</title>
</head>
<style>
* {
margin: 0;
padding: 0;
}
#map {
height: 100vh;
width: 100%;
}
@media only screen and (min-width: 600px) {
.umut {
background-color: black;
color: white;
text-decoration: none;
position: absolute;
top: 5px;
right: 35%;
padding: 10px;
display: inline-block;
z-index: 99999999999;
}
.afet {
background-color: #4CAF50;
text-decoration: none;
position: absolute;
top: 20px;
right: 20px;
margin-top: 50px;
padding: 10px;
display: inline-block;
z-index: 99999999999;
}
}
@media only screen and (max-width: 600px) {
.umut {
background-color: black;
color: white;
text-decoration: none;
position: absolute;
top: 5px;
width: 51%;
text-align: center;
height: 16%;
right: 45%;
padding: 10px;
display: inline-block;
z-index: 99999999999;
}
.afet {
background-color: #4CAF50;
text-decoration: none;
position: absolute;
top: 20px;
right: 20px;
margin-top: 20%;
padding: 10px;
display: inline-block;
z-index: 99999999999;
}
}
.refreshButton {
background-color: #4CAF50;
text-decoration: none;
position: absolute;
top: 20px;
right: 20px;
padding: 10px;
display: inline-block;
z-index: 99999999999;
}
</style>
<body>
<div id="map">
<div class="umut"><b>İBB tarafından tahmin edilen deprem verileridir.<br>Veri seti 7.5 Mw büyüklüğünde gece
olacak deprem senaryosuna göre yapılan analizlerin sonuçlarını içerir.<br>Kaynak : <a target='_blank'
href='https://data.ibb.gov.tr/dataset/deprem-senaryosu-analiz-sonuclari/resource/9c3ac492-de4b-4245-b418-7ad3df67a193'>İBB
Deprem Senaryosu Analizi</a><br>Fay Hatları : <a target="_blank" href="https://github.com/GEMScienceTools/gem-global-active-faults">GEM Global Active Faults Database (GEM GAF-DB)</a></b></div>
</div>
<div id="gizle"></div>
</body>
<script>
if (L.Browser.ie) { alert('Lütfen tarayıcınızı yenileyin!'); }
var map = L.map('map').setView([41.0836197, 29.1218511], 10);
L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/{z}/{y}/{x}', {
attribution: '© <a target="blank" href="http://www.openstreetmap.org/copyright">OpenStreetMap</a>' + ' | © <a target="blank" href="https://alicangonullu.org/yasal">Ali Can Gönüllü</a>'
}).addTo(map);
var markers = L.markerClusterGroup();
function isLocationFree(look, search) {
for (var i = 0, l = look.length; i < l; i++) {
if (look[i][0] == search[0] && look[i][1] == search[1]) {
return false;
} else {
return true;
}
}
}
// Kaynak : https://data.ibb.gov.tr/dataset/deprem-senaryosu-analiz-sonuclari/resource/9c3ac492-de4b-4245-b418-7ad3df67a193
function ekleveri(lat, lon, aciklama) {
var http = new XMLHttpRequest();
http.open("GET", "deprem.json", true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.onreadystatechange = function () {
const json = JSON.parse(http.responseText);
for (let i = 0; i <= json.length; i++) {
var bul = json[i]["ilce_adi"] + "," + json[i]["mahalle_adi"]
if (bul == aciklama) {
var yaz = "<b>Bu bilgierin tamamı İBB tarafından simülasyon yazılımlarıyla TAHMİN edilmiştir!<br>" +
"Kaynak : <a target='_blank' href='https://data.ibb.gov.tr/dataset/deprem-senaryosu-analiz-sonuclari/resource/9c3ac492-de4b-4245-b418-7ad3df67a193'>İBB Deprem Senaryosu Analizi</a></b><hr></hr>" +
"İlçe, Mahalle : " + bul +
"<br>Çok Ağır Hasarlı : " + json[i]["cok_agir_hasarli_bina_sayisi"] +
"<br>Ağır Hasarlı : " + json[i]["agir_hasarli_bina_sayisi"] +
"<br>Orta Hasarlı Bina : " + json[i]["agir_hasarli_bina_sayisi"] +
"<br>Hafif Hasarlı Bina : " + json[i]["hafif_hasarli_bina_sayisi"] +
"<br>Can Kaybı Sayısı : " + json[i]["can_kaybi_sayisi"] +
"<br>Ağır Yaralı Sayısı : " + json[i]["agir_yarali_sayisi"] +
"<br>Hastanede Tedavi Sayısı : " + json[i]["hastanede_tedavi_sayisi"] +
"<br>Hafif Yaralı Sayısı : " + json[i]["hafif_yarali_sayisi"] +
"<hr><hr>" +
"<br>Doğalgaz Boru Hasarı : " + json[i]["dogalgaz_boru_hasari"] +
"<br>İçme Suyu Boru Hasarı : " + json[i]["icme_suyu_boru_hasari"] +
"<br>İçme Suyu Boru Hasarı : " + json[i]["atik_su_boru_hasari"] +
"<br>Geçici Barınma : " + json[i]["gecici_barinma"] + "";
var lookup = [];
lookup.push([lat, lon]);
if (isLocationFree(lookup, [lat, lon]) == false) {
var marker = L.marker(new L.LatLng(lat, lon));
marker.bindPopup(yaz).openPopup();
markers.addLayer(marker);
map.addLayer(markers);
map.fitBounds(markers.getBounds());
}
}
}
}
http.send();
}
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
function ilce_konum() {
var http = new XMLHttpRequest();
http.open("GET", "ilce.json", true);
http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
http.onreadystatechange = function () {
const json = JSON.parse(http.responseText);
for (let i = 0; i <= json.length; i++) {
ekleveri(json[i]["lat"], json[i]["lon"], json[i]["ilce_adi"]);
sleep(3000);
}
}
http.send();
}
ilce_konum();
document.getElementById("gizle").innerHTML = '<a target="_blank" onclick="fay_hatlari()" class="refreshButton" style="color: #ffffff;">Fay Hatlarını Göster</a>';
function fay_hatlari() {
$.getJSON("fay_hatlari_global.geojson", function (data) {
L.geoJson(data).addTo(map);
});
document.getElementById("gizle").innerHTML = '';
document.getElementById("gizle").innerHTML = '<a target="_blank" onclick="silfay()" class="refreshButton" style="color: #ffffff;">Fay Hatlarını Gizle</a>';
}
function silfay() {
location.reload();
}
</script>