Initial WebGIS portal project
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
require_once __DIR__ . '/db_pdo.php';
|
||||
require_once __DIR__ . '/spatial_helpers.php';
|
||||
|
||||
$sql = 'SELECT id, nama_pemilik, status_kepemilikan, luas_m2, ST_AsGeoJSON(geom) AS geometry_geojson, created_at, updated_at FROM parsil_tanah ORDER BY id DESC';
|
||||
$stmt = $pdo->query($sql);
|
||||
$rows = $stmt->fetchAll();
|
||||
|
||||
$data = [];
|
||||
foreach ($rows as $row) {
|
||||
$row['id'] = (int) $row['id'];
|
||||
$row['luas_m2'] = (float) $row['luas_m2'];
|
||||
$row['geometry_geojson'] = json_decode((string) $row['geometry_geojson'], true);
|
||||
$data[] = $row;
|
||||
}
|
||||
|
||||
json_response(200, [
|
||||
'success' => true,
|
||||
'data' => $data,
|
||||
]);
|
||||
Reference in New Issue
Block a user