Skip to content

Commit

Permalink
defalult geometry column name
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxxen committed Jan 10, 2024
1 parent 947b1d9 commit 7a3e4b1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion spatial/src/spatial/gdal/functions/st_read_meta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "spatial/gdal/file_handler.hpp"

#include "ogrsf_frmts.h"
#include <cstring>

namespace spatial {

Expand Down Expand Up @@ -110,7 +111,11 @@ static Value GetLayerData(GDALDatasetUniquePtr &dataset) {
vector<Value> geometry_fields;
for(const auto &field : layer->GetLayerDefn()->GetGeomFields()) {
child_list_t<Value> 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()));

Expand Down

0 comments on commit 7a3e4b1

Please sign in to comment.