lng, (float)$c->lat]; } // Pastikan poligon tertutup (titik pertama sama dengan titik terakhir) if (!empty($polygon_ring) && ($polygon_ring[0] !== end($polygon_ring))) { $polygon_ring[] = $polygon_ring[0]; } $features[] = [ "type" => "Feature", "geometry" => [ "type" => "Polygon", "coordinates" => [$polygon_ring] // Array bersarang untuk Polygon ], "properties" => [ "id" => $row['id'], "pemilik" => $row['nama_pemilik'], "status" => $row['status_kepemilikan'], "luas" => $row['luas_tanah'] ] ]; } $geojson = [ "type" => "FeatureCollection", "features" => $features ]; echo json_encode($geojson); ?>