From 7a3e4b16b11c4d29d8a929dc180f95c6cf74b20b Mon Sep 17 00:00:00 2001 From: Max Gabrielsson Date: Wed, 10 Jan 2024 15:39:05 +0100 Subject: [PATCH] defalult geometry column name --- spatial/src/spatial/gdal/functions/st_read_meta.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spatial/src/spatial/gdal/functions/st_read_meta.cpp b/spatial/src/spatial/gdal/functions/st_read_meta.cpp index af6e97fa..ed17177e 100644 --- a/spatial/src/spatial/gdal/functions/st_read_meta.cpp +++ b/spatial/src/spatial/gdal/functions/st_read_meta.cpp @@ -9,6 +9,7 @@ #include "spatial/gdal/file_handler.hpp" #include "ogrsf_frmts.h" +#include namespace spatial { @@ -110,7 +111,11 @@ static Value GetLayerData(GDALDatasetUniquePtr &dataset) { vector geometry_fields; for(const auto &field : layer->GetLayerDefn()->GetGeomFields()) { child_list_t geometry_field_value_fields; - geometry_field_value_fields.emplace_back("name", Value(field->GetNameRef())); + auto field_name = field->GetNameRef(); + if(std::strlen(field_name) == 0) { + field_name = "geom"; + } + geometry_field_value_fields.emplace_back("name", Value(field_name)); geometry_field_value_fields.emplace_back("type", Value(OGRGeometryTypeToName(field->GetType()))); geometry_field_value_fields.emplace_back("nullable", Value(field->IsNullable()));