@@ -25,7 +25,7 @@ public function __construct()
25
25
26
26
public function getGempaM5Terkini ()
27
27
{
28
- $ url = 'https://data.bmkg.go.id/autogempa.xml ' ;
28
+ $ url = 'https://data.bmkg.go.id/DataMKG/TEWS/ autogempa.xml ' ;
29
29
$ type = 'Gempa M 5.0+ Terkini ' ;
30
30
31
31
$ bmkg = $ this ->_data ($ url , $ type );
@@ -83,63 +83,10 @@ public function getGempaM5Terkini()
83
83
return json_encode ($ result );
84
84
}
85
85
86
- public function getGempaBerpotensiTsunamiTerkini ()
87
- {
88
- $ url = 'https://data.bmkg.go.id/lasttsunami.xml ' ;
89
- $ type = 'Gempa Berpotensi Tsunami Terkini ' ;
90
-
91
- $ bmkg = json_decode (json_encode ($ this ->_data ($ url , $ type )), TRUE );
92
-
93
- // creator
94
- $ result ['creator ' ]['name ' ] = $ this ->_name ;
95
- $ result ['creator ' ]['homepage ' ] = $ this ->_homepage ;
96
- $ result ['creator ' ]['telegram ' ] = $ this ->_telegram ;
97
- $ result ['creator ' ]['source_code ' ] = $ this ->_source_code ;
98
-
99
- // BMKG
100
- $ result ['data_source ' ]['institution ' ] = $ this ->_bmkg ;
101
- $ result ['data_source ' ]['type ' ] = $ type ;
102
- $ result ['data_source ' ]['url ' ] = $ url ;
103
-
104
- // geojson
105
- $ result ['type ' ] = 'FeatureCollection ' ;
106
- $ result ['features ' ] = array ();
107
-
108
- if ($ bmkg ['success ' ]) {
109
- // success
110
- $ result ['success ' ] = true ;
111
-
112
- // type
113
- $ result ['features ' ][0 ]['type ' ] = 'Feature ' ;
114
-
115
- //properties
116
- $ result ['features ' ][0 ]['properties ' ]['tanggal ' ] = $ bmkg ['data ' ]['Gempa ' ]['Tanggal ' ];
117
- $ result ['features ' ][0 ]['properties ' ]['jam ' ] = $ bmkg ['data ' ]['Gempa ' ]['Jam ' ];
118
- $ result ['features ' ][0 ]['properties ' ]['lintang ' ] = $ bmkg ['data ' ]['Gempa ' ]['Lintang ' ];
119
- $ result ['features ' ][0 ]['properties ' ]['bujur ' ] = $ bmkg ['data ' ]['Gempa ' ]['Bujur ' ];
120
- $ result ['features ' ][0 ]['properties ' ]['magnitude ' ] = $ bmkg ['data ' ]['Gempa ' ]['Magnitude ' ];
121
- $ result ['features ' ][0 ]['properties ' ]['kedalaman ' ] = $ bmkg ['data ' ]['Gempa ' ]['Kedalaman ' ];
122
- $ result ['features ' ][0 ]['properties ' ]['area ' ] = $ bmkg ['data ' ]['Gempa ' ]['Area ' ];
123
- $ result ['features ' ][0 ]['properties ' ]['linkdetail ' ] = $ bmkg ['data ' ]['Gempa ' ]['Linkdetail ' ];
124
-
125
- // geometry
126
- $ result ['features ' ][0 ]['geometry ' ]['type ' ] = 'Point ' ;
127
- $ result ['features ' ][0 ]['geometry ' ]['coordinates ' ] = [floatval ($ bmkg ['data ' ]['Gempa ' ]['Bujur ' ]), floatval ($ bmkg ['data ' ]['Gempa ' ]['Lintang ' ])];
128
- } else {
129
- $ result ['success ' ] = false ;
130
- }
131
-
132
- // header
133
- header ('HTTP/1.1 200 OK ' );
134
- header ('Content-Type: application/json ' );
135
-
136
- return json_encode ($ result );
137
- }
138
-
139
86
public function getGempaM5 ()
140
87
{
141
- $ url = 'https://data.bmkg.go.id/gempaterkini.xml ' ;
142
- $ type = '60 Gempabumi M 5.0+ ' ;
88
+ $ url = 'https://data.bmkg.go.id/DataMKG/TEWS/ gempaterkini.xml ' ;
89
+ $ type = '15 Gempa Bumi M 5.0+ ' ;
143
90
144
91
$ bmkg = $ this ->_data ($ url , $ type );
145
92
@@ -197,8 +144,8 @@ public function getGempaM5()
197
144
198
145
public function getGempaDirasakan ()
199
146
{
200
- $ url = 'https://data.bmkg.go.id/gempadirasakan.xml ' ;
201
- $ type = '20 Gempabumi Dirasakan ' ;
147
+ $ url = 'https://data.bmkg.go.id/DataMKG/TEWS/ gempadirasakan.xml ' ;
148
+ $ type = '15 Gempa Bumi Dirasakan ' ;
202
149
203
150
$ bmkg = $ this ->_data ($ url , $ type );
204
151
@@ -221,23 +168,24 @@ public function getGempaDirasakan()
221
168
// success
222
169
$ result ['success ' ] = true ;
223
170
224
- for ($ i = 0 ; $ i < count ($ bmkg ['data ' ]['Gempa ' ]); $ i ++) {
171
+ for ($ i = 0 ; $ i < count ($ bmkg ['data ' ]['gempa ' ]); $ i ++) {
225
172
// type
226
173
$ gempa ['type ' ] = 'Feature ' ;
227
174
228
175
//properties
229
- $ gempa ['properties ' ]['tanggal ' ] = $ bmkg ['data ' ]['Gempa ' ][$ i ]['Tanggal ' ];
230
- $ gempa ['properties ' ]['posisi ' ] = $ bmkg ['data ' ]['Gempa ' ][$ i ]['Posisi ' ];
231
- $ gempa ['properties ' ]['magnitude ' ] = $ bmkg ['data ' ]['Gempa ' ][$ i ]['Magnitude ' ];
232
- $ gempa ['properties ' ]['kedalaman ' ] = $ bmkg ['data ' ]['Gempa ' ][$ i ]['Kedalaman ' ];
233
- $ gempa ['properties ' ]['keterangan ' ] = $ bmkg ['data ' ]['Gempa ' ][$ i ]['Keterangan ' ];
234
- $ gempa ['properties ' ]['dirasakan ' ] = $ bmkg ['data ' ]['Gempa ' ][$ i ]['Dirasakan ' ];
176
+ $ gempa ['properties ' ]['tanggal ' ] = $ bmkg ['data ' ]['gempa ' ][$ i ]['Tanggal ' ];
177
+ $ gempa ['properties ' ]['jam ' ] = $ bmkg ['data ' ]['gempa ' ][$ i ]['Jam ' ];
178
+ $ gempa ['properties ' ]['lintang ' ] = $ bmkg ['data ' ]['gempa ' ][$ i ]['Lintang ' ];
179
+ $ gempa ['properties ' ]['bujur ' ] = $ bmkg ['data ' ]['gempa ' ][$ i ]['Bujur ' ];
180
+ $ gempa ['properties ' ]['magnitude ' ] = $ bmkg ['data ' ]['gempa ' ][$ i ]['Magnitude ' ];
181
+ $ gempa ['properties ' ]['kedalaman ' ] = $ bmkg ['data ' ]['gempa ' ][$ i ]['Kedalaman ' ];
182
+ $ gempa ['properties ' ]['dirasakan ' ] = $ bmkg ['data ' ]['gempa ' ][$ i ]['Dirasakan ' ];
235
183
236
184
// geometry
237
- $ coordinates = explode (', ' , $ bmkg ['data ' ]['Gempa ' ][$ i ]['point ' ]['coordinates ' ]);
185
+ $ coordinates = explode (', ' , $ bmkg ['data ' ]['gempa ' ][$ i ]['point ' ]['coordinates ' ]);
238
186
239
187
$ gempa ['geometry ' ]['type ' ] = 'Point ' ;
240
- $ gempa ['geometry ' ]['coordinates ' ] = [floatval ($ coordinates [1 ]), floatval ($ coordinates [0 ])];
188
+ $ gempa ['geometry ' ]['coordinates ' ] = [floatval ($ coordinates [0 ]), floatval ($ coordinates [1 ])];
241
189
242
190
// tambahkan ke array $result['features']
243
191
array_push ($ result ['features ' ], $ gempa );
@@ -246,6 +194,7 @@ public function getGempaDirasakan()
246
194
$ result ['success ' ] = false ;
247
195
}
248
196
197
+
249
198
// header
250
199
header ('HTTP/1.1 200 OK ' );
251
200
header ('Content-Type: application/json ' );
0 commit comments