From 8e659c5245fb118c08d457a0c3618cc6d0f059c7 Mon Sep 17 00:00:00 2001 From: Nihar Thakkar Date: Tue, 10 Dec 2024 14:40:13 +0000 Subject: [PATCH] fix: clean imported layer attribute mapping --- src/crud/crud_layer.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/crud/crud_layer.py b/src/crud/crud_layer.py index 85c8136..d9e6bf2 100644 --- a/src/crud/crud_layer.py +++ b/src/crud/crud_layer.py @@ -829,7 +829,11 @@ async def import_file( for field_name in field_names: if field_name == "id": continue - attribute_mapping[field_type + "_attr" + str(cnt)] = field_name + # Replace hyphens with an underscore as ogr2ogr also does this while importing the layer + # TODO: Find a more robust way to sync changes made by ogr2ogr to field names and this attribute mapping + attribute_mapping[field_type + "_attr" + str(cnt)] = field_name.replace( + "-", "_" + ) cnt += 1 # Upload file to temporary table using ogr2ogr