Project UAS Sistem Informasi Geografis (SIG)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
include 'db.php';
|
||||
|
||||
$data = [];
|
||||
|
||||
/* POINT */
|
||||
$res = $conn->query("SELECT * FROM spbu");
|
||||
if ($res) {
|
||||
while ($r = $res->fetch_assoc()) {
|
||||
$r['type'] = 'point';
|
||||
$data[] = $r;
|
||||
}
|
||||
}
|
||||
|
||||
/* POLYLINE */
|
||||
$res = $conn->query("SELECT * FROM jalan");
|
||||
if ($res) {
|
||||
while ($r = $res->fetch_assoc()) {
|
||||
$r['type'] = 'line';
|
||||
$data[] = $r;
|
||||
}
|
||||
}
|
||||
|
||||
/* POLYGON */
|
||||
$res = $conn->query("SELECT * FROM parsil");
|
||||
if ($res) {
|
||||
while ($r = $res->fetch_assoc()) {
|
||||
$r['type'] = 'polygon';
|
||||
$data[] = $r;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($data);
|
||||
?>
|
||||
Reference in New Issue
Block a user