Skip to content

Commit

Permalink
Arrow/Parquet: use recommended item names for GeoArrow Interleaved [m…
Browse files Browse the repository at this point in the history
…ulti]line, [multi]polygon, multipoint
  • Loading branch information
rouault committed Oct 7, 2024
1 parent 8cbe405 commit 151ead8
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions ogr/ogrsf_frmts/arrow_common/ograrrowwriterlayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,18 @@ inline void OGRArrowWriterLayer::CreateSchemaCommon()
arrow::field("m", arrow::float64(), false));
auto pointStructType(arrow::struct_(std::move(pointFields)));

const auto getListOfVertices = [&getFixedSizeListOfPoint]()
{
return arrow::list(std::make_shared<arrow::Field>(
"vertices", getFixedSizeListOfPoint()));
};

const auto getListOfRings = [&getListOfVertices]()
{
return arrow::list(
std::make_shared<arrow::Field>("rings", getListOfVertices()));
};

std::shared_ptr<arrow::DataType> dt;
switch (m_aeGeomEncoding[i])
{
Expand All @@ -340,24 +352,26 @@ inline void OGRArrowWriterLayer::CreateSchemaCommon()
break;

case OGRArrowGeomEncoding::GEOARROW_FSL_LINESTRING:
dt = arrow::list(getFixedSizeListOfPoint());
dt = getListOfVertices();
break;

case OGRArrowGeomEncoding::GEOARROW_FSL_POLYGON:
dt = arrow::list(arrow::list(getFixedSizeListOfPoint()));
dt = getListOfRings();
break;

case OGRArrowGeomEncoding::GEOARROW_FSL_MULTIPOINT:
dt = arrow::list(getFixedSizeListOfPoint());
dt = arrow::list(std::make_shared<arrow::Field>(
"points", getFixedSizeListOfPoint()));
break;

case OGRArrowGeomEncoding::GEOARROW_FSL_MULTILINESTRING:
dt = arrow::list(arrow::list(getFixedSizeListOfPoint()));
dt = arrow::list(std::make_shared<arrow::Field>(
"linestrings", getListOfVertices()));
break;

case OGRArrowGeomEncoding::GEOARROW_FSL_MULTIPOLYGON:
dt = arrow::list(
arrow::list(arrow::list(getFixedSizeListOfPoint())));
dt = arrow::list(std::make_shared<arrow::Field>(
"polygons", getListOfRings()));
break;

case OGRArrowGeomEncoding::GEOARROW_STRUCT_POINT:
Expand Down

0 comments on commit 151ead8

Please sign in to comment.