From ff3827e7246bfacbc9b2e530209872b46f266f18 Mon Sep 17 00:00:00 2001 From: Kris Date: Sat, 6 Jun 2026 14:17:28 +0000 Subject: [PATCH] Upload files to "/" --- README.md | 30 ++++++++++++++ api.php | 15 +++++++ connect.php | 16 ++++++++ database.sql | 20 +++++++++ index.html | 113 +++++++++++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 194 insertions(+) create mode 100644 README.md create mode 100644 api.php create mode 100644 connect.php create mode 100644 database.sql create mode 100644 index.html diff --git a/README.md b/README.md new file mode 100644 index 0000000..5c90bc1 --- /dev/null +++ b/README.md @@ -0,0 +1,30 @@ +# Project 3 - Layer Groups dan Layers Control SPBU + +Project ini khusus untuk memperlihatkan konsep: + +- `L.layerGroup()` +- `L.control.layers()` +- Pemisahan layer berdasarkan atribut data + +Data SPBU dipisahkan menjadi: + +1. SPBU buka 24 jam. +2. SPBU tidak buka 24 jam. + +## Database + +Import file `database.sql` ke phpMyAdmin. Database yang dibuat adalah: + +`webgis_spbu_layer_p3` + +Tabel utama: + +`spbu` + +## Cara Menjalankan + +1. Letakkan folder ini di `htdocs`. +2. Jalankan Apache dan MySQL. +3. Import `database.sql`. +4. Buka `http://localhost/webgis_pisah/project_03_layer_control_spbu/`. +5. Gunakan checkbox layer di kanan atas untuk menampilkan atau menyembunyikan kelompok SPBU. diff --git a/api.php b/api.php new file mode 100644 index 0000000..efc8398 --- /dev/null +++ b/api.php @@ -0,0 +1,15 @@ +query($sql); +$data = []; + +while ($row = $result->fetch_assoc()) { + $data[] = $row; +} + +echo json_encode($data); +$conn->close(); +?> diff --git a/connect.php b/connect.php new file mode 100644 index 0000000..761f7a9 --- /dev/null +++ b/connect.php @@ -0,0 +1,16 @@ +connect_error) { + http_response_code(500); + die(json_encode([ + "status" => "error", + "message" => "Koneksi database gagal: " . $conn->connect_error + ])); +} +?> diff --git a/database.sql b/database.sql new file mode 100644 index 0000000..fc68a7e --- /dev/null +++ b/database.sql @@ -0,0 +1,20 @@ +CREATE DATABASE IF NOT EXISTS webgis_spbu_layer_p3; +USE webgis_spbu_layer_p3; + +DROP TABLE IF EXISTS spbu; +CREATE TABLE spbu ( + id INT AUTO_INCREMENT PRIMARY KEY, + nama_spbu VARCHAR(150) NOT NULL, + alamat TEXT NULL, + status_24_jam ENUM('Ya', 'Tidak') NOT NULL DEFAULT 'Tidak', + kontak VARCHAR(50) NULL, + geojson LONGTEXT NOT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP, + updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP +); + +INSERT INTO spbu (nama_spbu, alamat, status_24_jam, kontak, geojson) VALUES +('SPBU Ahmad Yani', 'Jl. Ahmad Yani, Pontianak', 'Ya', '081234567890', '{"type":"Point","coordinates":[109.3425,-0.0442]}'), +('SPBU Gajah Mada', 'Jl. Gajah Mada, Pontianak', 'Tidak', '081234567891', '{"type":"Point","coordinates":[109.3338,-0.0271]}'), +('SPBU Imam Bonjol', 'Jl. Imam Bonjol, Pontianak', 'Ya', '081234567892', '{"type":"Point","coordinates":[109.3448,-0.0316]}'), +('SPBU Tanjung Raya', 'Jl. Tanjung Raya II, Pontianak', 'Tidak', '081234567893', '{"type":"Point","coordinates":[109.3741,-0.0292]}'); diff --git a/index.html b/index.html new file mode 100644 index 0000000..c76fac3 --- /dev/null +++ b/index.html @@ -0,0 +1,113 @@ + + + + + + Project 3 - Layer Groups dan Layers Control SPBU + + + + +
+

Project 3 - Layer Groups & Layers Control

+

Data SPBU dipisahkan menjadi layer 24 jam dan tidak 24 jam.

+
+
+ + + + +