commit cd1633a0b7e8b8a3d21f8a287a5a9548ecaca08a Author: WilhelmusIkchanDwiPutra_00 Date: Fri Jun 12 17:20:41 2026 +0000 Upload files to "/" diff --git a/get_data.php b/get_data.php new file mode 100644 index 0000000..4707dcb --- /dev/null +++ b/get_data.php @@ -0,0 +1,27 @@ + [], 'parsil' => []]; + +// Ambil Jalan +$res_jalan = $conn->query("SELECT * FROM data_jalan"); +while($row = $res_jalan->fetch_assoc()) { + $response['jalan'][] = [ + 'id' => $row['id'], 'nama' => $row['nama_jalan'], 'status' => $row['status_jalan'], + 'panjang' => $row['panjang_meter'], 'geojson' => json_decode($row['geojson']) + ]; +} + +// Ambil Parsil +$res_parsil = $conn->query("SELECT * FROM data_parsil"); +while($row = $res_parsil->fetch_assoc()) { + $response['parsil'][] = [ + 'id' => $row['id'], 'kode' => $row['kode_kavling'], 'status' => $row['status_kepemilikan'], + 'luas' => $row['luas_meter'], 'geojson' => json_decode($row['geojson']) + ]; +} + +echo json_encode($response); +$conn->close(); +?> \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..7547ad1 --- /dev/null +++ b/index.php @@ -0,0 +1,201 @@ + + + + + WebGIS Manajemen Jalan & Parsil Tanah + + + + + + + + + +

Manajemen Data Spasial Jalan & Parsil Tanah - Kota Pontianak

+
+ +
+
+

Input Data Spasial

+
+ + + + + +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+
+ +
+

Daftar Data Tersimpan

+
+
+

Data Jalan (Line)

+ + +
Nama JalanStatusPanjang (m)Aksi
+
+
+

Data Parsil (Polygon)

+ + +
Kode KavlingStatusLuas (m²)Aksi
+
+
+
+
+ + + + \ No newline at end of file diff --git a/proses.php b/proses.php new file mode 100644 index 0000000..6f5fd51 --- /dev/null +++ b/proses.php @@ -0,0 +1,57 @@ +connect_error) { + die("Koneksi gagal: " . $conn->connect_error); +} + +$action = isset($_GET['action']) ? $_GET['action'] : (isset($_POST['action']) ? $_POST['action'] : ''); + +// --- PROSES SIMPAN DATA (CREATE) --- +if ($action == 'create' && $_SERVER['REQUEST_METHOD'] == 'POST') { + $type = $_POST['type']; + $nama_atribut = $_POST['nama_atribut']; + $status = $_POST['status']; + $geojson = $_POST['geojson']; + + // Ambil string input (Contoh: "1500.50 Meter" atau "300.45 m²") + $mentah = $_POST['hasil_hitung']; + + // Gunakan regex untuk mengambil angka dan desimalnya saja agar aman masuk ke kolom FLOAT + preg_match('/[0-9.]+/', $mentah, $matches); + $angka_murni = isset($matches[0]) ? floatval($matches[0]) : 0; + + if ($type == 'jalan') { + $sql = "INSERT INTO data_jalan (nama_jalan, status_jalan, panjang_meter, geojson) + VALUES ('$nama_atribut', '$status', '$angka_murni', '$geojson')"; + } else if ($type == 'parsil') { + $sql = "INSERT INTO data_parsil (kode_kavling, status_kepemilikan, luas_meter, geojson) + VALUES ('$nama_atribut', '$status', '$angka_murni', '$geojson')"; + } + + if ($conn->query($sql) === TRUE) { + echo ""; + } else { + echo "Error: " . $sql . "
" . $conn->error; + } +} + +// --- PROSES HAPUS DATA (DELETE) --- +if ($action == 'delete' && isset($_GET['id']) && isset($_GET['type'])) { + $id = intval($_GET['id']); + $type = $_GET['type']; + + if ($type == 'jalan') { + $sql = "DELETE FROM data_jalan WHERE id = $id"; + } else if ($type == 'parsil') { + $sql = "DELETE FROM data_parsil WHERE id = $id"; + } + + if ($conn->query($sql) === TRUE) { + echo ""; + } +} + +$conn->close(); +?> \ No newline at end of file diff --git a/simpan.php b/simpan.php new file mode 100644 index 0000000..d8ea0fa --- /dev/null +++ b/simpan.php @@ -0,0 +1,35 @@ +connect_error) { + die("Koneksi Gagal: " . $conn->connect_error); +} + +if ($_SERVER['REQUEST_METHOD'] == 'POST') { + $type = $_POST['type']; + $nama_atribut = $_POST['nama_atribut']; + $status = $_POST['status']; + $hasil_hitung = $_POST['hasil_hitung']; + $geojson = $_POST['geojson']; // String GeoJSON dari Leaflet + + if ($type == 'jalan') { + $sql = "INSERT INTO data_jalan (nama_jalan, status_jalan, panjang_meter, geojson) + VALUES ('$nama_atribut', '$status', '$hasil_hitung', '$geojson')"; + } else if ($type == 'parsil') { + $sql = "INSERT INTO data_parsil (kode_kavling, status_kepemilikan, luas_meter, geojson) + VALUES ('$nama_atribut', '$status', '$hasil_hitung', '$geojson')"; + } + + if ($conn->query($sql) === TRUE) { + echo ""; + } else { + echo "Error: " . $sql . "
" . $conn->error; + } +} +$conn->close(); +?> \ No newline at end of file