-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpreprocessor.php
29 lines (24 loc) · 995 Bytes
/
preprocessor.php
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
<?php
$data = file_get_contents('src/json/raw/koordinat_iup_2015_2016.json');
$data = json_decode($data, true);
$total = count($data['rows']);
$x['type'] = 'FeatureCollection';
for ($i=0; $i < $total; $i++)
{
if (!is_null($data['rows'][$i]['longitude']))
{
$x['features'][$i]['type'] = 'Feature';
$x['features'][$i]['properties']['jenis_izin'] = $data['rows'][$i]['jenis_izin'];
$x['features'][$i]['properties']['nama_perusahaan'] = strtoupper($data['rows'][$i]['nama_perusahaan']);
$x['features'][$i]['properties']['nomor_izin'] = $data['rows'][$i]['nomor_izin'];
$x['features'][$i]['properties']['tgl_akhir'] = $data['rows'][$i]['tgl_akhir'];
$x['features'][$i]['geometry']['type'] = 'Point';
$x['features'][$i]['geometry']['coordinates'][] = $data['rows'][$i]['longitude'];
$x['features'][$i]['geometry']['coordinates'][] = $data['rows'][$i]['latitude'];
}
}
/*echo "<pre>";
print_r ($x);
echo "</pre>";*/
echo json_encode($x);
?>