query("SELECT * FROM ibadah"); while ($row = $q1->fetch_assoc()) { $features[] = [ "type" => "Feature", "properties" => [ "tipe" => "ibadah", "id" => $row['id'], "nama" => $row['nama'], "jenis" => $row['jenis'], "radius" => $row['radius'] ], "geometry" => [ "type" => "Point", "coordinates" => [(float)$row['lng'], (float)$row['lat']] ] ]; } // ==================== // WARGA // ==================== $q2 = $conn->query("SELECT * FROM warga"); while ($row = $q2->fetch_assoc()) { $features[] = [ "type" => "Feature", "properties" => [ "tipe" => "warga", "id" => $row['id'], "nama" => $row['nama'], "jumlah_kk" => $row['jumlah_kk'], "pengurus" => $row['pengurus'] ], "geometry" => [ "type" => "Point", "coordinates" => [(float)$row['lng'], (float)$row['lat']] ] ]; } // output GeoJSON echo json_encode([ "type" => "FeatureCollection", "features" => $features ]); ?>