query("SELECT id, nama, jenis, ST_AsGeoJSON(geom) AS geojson FROM fasilitas_publik ORDER BY jenis, nama"); $features = []; while ($r = $stmt->fetch()) { $features[] = [ 'type' => 'Feature', 'geometry' => json_decode($r['geojson']), 'properties' => ['id' => (int)$r['id'], 'nama' => $r['nama'], 'jenis' => $r['jenis']], ]; } sendSuccess(['type' => 'FeatureCollection', 'features' => $features], 'Fasilitas Publik');