From cf12658dd7c06841c711d427289a4f7ac2b9e233 Mon Sep 17 00:00:00 2001 From: shlomiko Date: Mon, 22 Sep 2025 10:28:55 +0300 Subject: [PATCH 1/4] fix: generated feature id to append to feature properties --- src/files/shapefile/core/shapeFileReader.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/files/shapefile/core/shapeFileReader.ts b/src/files/shapefile/core/shapeFileReader.ts index e336219..f5ec6c3 100644 --- a/src/files/shapefile/core/shapeFileReader.ts +++ b/src/files/shapefile/core/shapeFileReader.ts @@ -49,8 +49,14 @@ export class ShapefileChunkReader { continue; } - const feature = { ...(generateFeatureId && { id: randomUUID() }), ...shapeFeature }; - if (feature.id !== undefined) { + const feature = { + ...shapeFeature, properties: { + ...(shapeFeature.properties?? {}), + ...(generateFeatureId && { id: randomUUID() }) + } + }; + + if (feature.properties.id !== undefined) { this.options.logger?.debug({ msg: `Feature ID: ${feature.id}` }); } From 5aef7fbfdc5998257f13caa37942baedefbfda7f Mon Sep 17 00:00:00 2001 From: shlomiko Date: Mon, 22 Sep 2025 10:31:50 +0300 Subject: [PATCH 2/4] chore: feature id log from feature properties --- src/files/shapefile/core/shapeFileReader.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/files/shapefile/core/shapeFileReader.ts b/src/files/shapefile/core/shapeFileReader.ts index f5ec6c3..5826e5c 100644 --- a/src/files/shapefile/core/shapeFileReader.ts +++ b/src/files/shapefile/core/shapeFileReader.ts @@ -57,7 +57,7 @@ export class ShapefileChunkReader { }; if (feature.properties.id !== undefined) { - this.options.logger?.debug({ msg: `Feature ID: ${feature.id}` }); + this.options.logger?.debug({ msg: `Feature ID: ${feature.properties.id}` }); } if (!chunkBuilder.canAddFeature(feature)) { From 1e63b58a0cb4f7aedd6fdcbc3e3bfe69f448c845 Mon Sep 17 00:00:00 2001 From: shlomiko Date: Thu, 25 Sep 2025 10:31:45 +0300 Subject: [PATCH 3/4] style: fix prettier --- src/files/shapefile/core/shapeFileReader.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/files/shapefile/core/shapeFileReader.ts b/src/files/shapefile/core/shapeFileReader.ts index 5826e5c..64b05f8 100644 --- a/src/files/shapefile/core/shapeFileReader.ts +++ b/src/files/shapefile/core/shapeFileReader.ts @@ -50,10 +50,11 @@ export class ShapefileChunkReader { } const feature = { - ...shapeFeature, properties: { - ...(shapeFeature.properties?? {}), - ...(generateFeatureId && { id: randomUUID() }) - } + ...shapeFeature, + properties: { + ...(shapeFeature.properties ?? {}), + ...(generateFeatureId && { id: randomUUID() }), + }, }; if (feature.properties.id !== undefined) { From 578e5ae26506b1d9952ee341586db993b2e26d0d Mon Sep 17 00:00:00 2001 From: shlomiko Date: Thu, 25 Sep 2025 13:03:16 +0300 Subject: [PATCH 4/4] chore: removed nullish coalescing operator --- src/files/shapefile/core/shapeFileReader.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/files/shapefile/core/shapeFileReader.ts b/src/files/shapefile/core/shapeFileReader.ts index 64b05f8..09e3946 100644 --- a/src/files/shapefile/core/shapeFileReader.ts +++ b/src/files/shapefile/core/shapeFileReader.ts @@ -52,7 +52,7 @@ export class ShapefileChunkReader { const feature = { ...shapeFeature, properties: { - ...(shapeFeature.properties ?? {}), + ...shapeFeature.properties, ...(generateFeatureId && { id: randomUUID() }), }, };