feat(parcel-sync): include no-geometry rows in Magic GPKG + HAS_GEOMETRY column

- Magic GPKG (terenuri_magic.gpkg) now contains ALL records:
  rows with geometry render as polygons, rows without have null geom
  but still carry all attribute/enrichment data (QGIS shows them fine)
- Added HAS_GEOMETRY column to Magic GPKG fields (0 or 1)
- GPKG builder now supports includeNullGeometry option: splits features
  into spatial-first (creates table), then appends null-geom rows
- Base terenuri.gpkg / cladiri.gpkg unchanged (spatial only)
- CSV still has all records as before
- GeoJsonFeature type now allows null geometry
- Reproject: null geometry guard added
- UI text updated: no longer says 'Nu apar in GPKG'
This commit is contained in:
AI Assistant
2026-03-07 18:06:28 +02:00
parent 96859dde4f
commit ba579d75c1
5 changed files with 106 additions and 38 deletions
+9 -9
View File
@@ -469,7 +469,7 @@ export async function POST(req: Request) {
const enrichment =
(record.enrichment as FeatureEnrichment | null) ??
({} as Partial<FeatureEnrichment>);
const geom = record.geometry as GeoJsonFeature["geometry"] | null;
const geom = record.geometry as GeoJsonFeature["geometry"];
const geomSource = (
record as unknown as { geometrySource: string | null }
).geometrySource;
@@ -504,13 +504,12 @@ export async function POST(req: Request) {
];
csvRows.push(row.map(csvEscape).join(","));
if (geom) {
magicFeatures.push({
type: "Feature",
geometry: geom,
properties: { ...attrs, ...e },
});
}
// ALL records go into magic GPKG — with or without geometry
magicFeatures.push({
type: "Feature",
geometry: geom,
properties: { ...attrs, ...e, HAS_GEOMETRY: hasGeometry },
});
}
csvContent = csvRows.join("\n");
@@ -522,8 +521,9 @@ export async function POST(req: Request) {
layers: [
{
name: "TERENURI_MAGIC",
fields: magicFields,
fields: [...magicFields, "HAS_GEOMETRY"],
features: magicFeatures,
includeNullGeometry: true,
},
],
}),