From ed184225a59dcfe17f141271347d546720cc4e7b Mon Sep 17 00:00:00 2001 From: naukyy Date: Sat, 13 Jun 2026 00:58:44 +0700 Subject: [PATCH] tampilkan data fix database --- 01/backend/api/jalan.php | 4 ++-- 01/backend/api/kavling.php | 5 +++-- 01/backend/api/spbu.php | 4 ++-- 02/backend/api/jalan.php | 4 ++-- 02/backend/api/kavling.php | 5 +++-- 02/backend/api/rumah_ibadah.php | 22 +++++++++++++++++++--- 02/backend/api/spbu.php | 4 ++-- 02/backend/api/warga_miskin.php | 4 ++-- 02/frontend/js/services/api.service.js | 2 +- 03/backend/api/jalan.php | 4 ++-- 03/backend/api/kavling.php | 5 +++-- 03/backend/api/rumah_ibadah.php | 22 +++++++++++++++++++--- 03/backend/api/spbu.php | 4 ++-- 03/backend/api/statistik.php | 22 +++++----------------- 03/backend/api/warga_miskin.php | 4 ++-- 03/frontend/js/services/api.service.js | 2 +- webgis_app/core_config/database.php | 2 +- 17 files changed, 71 insertions(+), 48 deletions(-) diff --git a/01/backend/api/jalan.php b/01/backend/api/jalan.php index 886efd9..4af25fd 100644 --- a/01/backend/api/jalan.php +++ b/01/backend/api/jalan.php @@ -1,10 +1,10 @@ - json_decode($row['geojson']), 'properties' => [ 'id' => $row['id'], + 'nama' => $row['nama_pemilik'], 'nama_pemilik' => $row['nama_pemilik'], 'luas' => $row['luas'], 'created_at' => $row['created_at'] diff --git a/01/backend/api/spbu.php b/01/backend/api/spbu.php index 6acaf74..6288187 100644 --- a/01/backend/api/spbu.php +++ b/01/backend/api/spbu.php @@ -1,5 +1,5 @@ - json_decode($row['geojson']), 'properties' => [ 'id' => $row['id'], + 'nama' => $row['nama_pemilik'], 'nama_pemilik' => $row['nama_pemilik'], 'luas' => $row['luas'], 'created_at' => $row['created_at'] diff --git a/02/backend/api/rumah_ibadah.php b/02/backend/api/rumah_ibadah.php index b1172c4..1986c98 100644 --- a/02/backend/api/rumah_ibadah.php +++ b/02/backend/api/rumah_ibadah.php @@ -1,10 +1,10 @@ - 'Feature', + 'geometry' => $w['geometry'], + 'properties' => [ + 'id' => $w['id'], + 'nama' => $w['nama_kk'], + 'penghasilan' => $w['penghasilan'], + 'jumlah_tanggungan' => $w['jumlah_tanggungan'], + 'jarak_km' => $w['jarak_km'] + ] + ]; + } + sendSuccess(['type' => 'FeatureCollection', 'features' => $features], 'Data jangkauan berhasil dihitung'); } else { // GET Semua Rumah Ibadah (GeoJSON) diff --git a/02/backend/api/spbu.php b/02/backend/api/spbu.php index 6acaf74..6288187 100644 --- a/02/backend/api/spbu.php +++ b/02/backend/api/spbu.php @@ -1,5 +1,5 @@ - { - const res = await fetch(`${BASE_URL}/02/backend/api/haversine.php?rumah_ibadah_id=${id}&radius_km=${radius}`); + const res = await fetch(`${BASE_URL}/02/backend/api/rumah_ibadah.php?action=jangkauan&id=${id}&radius=${radius}`); const json = await res.json(); return json.data; } diff --git a/03/backend/api/jalan.php b/03/backend/api/jalan.php index 886efd9..4af25fd 100644 --- a/03/backend/api/jalan.php +++ b/03/backend/api/jalan.php @@ -1,10 +1,10 @@ - json_decode($row['geojson']), 'properties' => [ 'id' => $row['id'], + 'nama' => $row['nama_pemilik'], 'nama_pemilik' => $row['nama_pemilik'], 'luas' => $row['luas'], 'created_at' => $row['created_at'] diff --git a/03/backend/api/rumah_ibadah.php b/03/backend/api/rumah_ibadah.php index b1172c4..1986c98 100644 --- a/03/backend/api/rumah_ibadah.php +++ b/03/backend/api/rumah_ibadah.php @@ -1,10 +1,10 @@ - 'Feature', + 'geometry' => $w['geometry'], + 'properties' => [ + 'id' => $w['id'], + 'nama' => $w['nama_kk'], + 'penghasilan' => $w['penghasilan'], + 'jumlah_tanggungan' => $w['jumlah_tanggungan'], + 'jarak_km' => $w['jarak_km'] + ] + ]; + } + sendSuccess(['type' => 'FeatureCollection', 'features' => $features], 'Data jangkauan berhasil dihitung'); } else { // GET Semua Rumah Ibadah (GeoJSON) diff --git a/03/backend/api/spbu.php b/03/backend/api/spbu.php index 6acaf74..6288187 100644 --- a/03/backend/api/spbu.php +++ b/03/backend/api/spbu.php @@ -1,5 +1,5 @@ -query($sql); $features = []; - $total_warga = 0; - while ($row = $stmt->fetch()) { $jumlah = (int) $row['jumlah_warga']; - $total_warga += $jumlah; $features[] = [ 'type' => 'Feature', 'geometry' => json_decode($row['geojson']), 'properties' => [ 'id' => $row['id'], + 'nama' => $row['nama_pemilik'], 'nama_pemilik' => $row['nama_pemilik'], 'luas' => $row['luas'], + 'jumlah_warga_miskin' => $jumlah, 'jumlah_warga' => $jumlah, 'total_tanggungan' => (int) $row['total_tanggungan'] ] ]; } - $response = [ - 'statistik' => [ - 'total_kavling' => count($features), - 'total_warga_terpetakan' => $total_warga - ], - 'geojson' => [ - 'type' => 'FeatureCollection', - 'features' => $features - ] - ]; - - sendSuccess($response, 'Data statistik spasial berhasil dihitung'); + sendSuccess(['type' => 'FeatureCollection', 'features' => $features], 'Data statistik spasial berhasil dihitung'); } catch (PDOException $e) { sendError('Gagal menghitung statistik spasial: ' . $e->getMessage(), 500); } diff --git a/03/backend/api/warga_miskin.php b/03/backend/api/warga_miskin.php index 2c48a44..63393da 100644 --- a/03/backend/api/warga_miskin.php +++ b/03/backend/api/warga_miskin.php @@ -1,10 +1,10 @@ - { - const res = await fetch(`${BASE_URL}/02/backend/api/haversine.php?rumah_ibadah_id=${id}&radius_km=${radius}`); + const res = await fetch(`${BASE_URL}/02/backend/api/rumah_ibadah.php?action=jangkauan&id=${id}&radius=${radius}`); const json = await res.json(); return json.data; } diff --git a/webgis_app/core_config/database.php b/webgis_app/core_config/database.php index 94b2143..7f099e1 100644 --- a/webgis_app/core_config/database.php +++ b/webgis_app/core_config/database.php @@ -1,4 +1,4 @@ -