feat(parcel-sync): native PostGIS geometry support for QGIS
- Remove postgresqlExtensions/postgis from Prisma schema (PostGIS not yet installed) - Add prisma/postgis-setup.sql: trigger auto-converts GeoJSON→native geometry, GiST spatial index, QGIS-friendly views (gis_terenuri, gis_cladiri, etc.) - Add POST /api/eterra/setup-postgis endpoint (idempotent, runs all SQL setup) - Add safety-net raw SQL in sync-service: backfills geom after upsert phase - Add QGIS/PostGIS setup card in layer catalog UI with connection info - Schema comment documents the trigger-managed 'geom' column approach
This commit is contained in:
@@ -221,6 +221,17 @@ export async function syncLayer(
|
||||
});
|
||||
}
|
||||
|
||||
// Populate native PostGIS geometry (safety net if trigger not installed)
|
||||
try {
|
||||
await prisma.$executeRaw`
|
||||
UPDATE "GisFeature"
|
||||
SET geom = ST_SetSRID(ST_GeomFromGeoJSON(geometry::text), 3844)
|
||||
WHERE "layerId" = ${layerId} AND siruta = ${siruta}
|
||||
AND geometry IS NOT NULL AND geom IS NULL`;
|
||||
} catch {
|
||||
// PostGIS not available yet — not critical, skip silently
|
||||
}
|
||||
|
||||
// Mark removed features
|
||||
if (removedObjIds.length > 0) {
|
||||
push({ phase: "Marcare șterse" });
|
||||
|
||||
Reference in New Issue
Block a user