Skip to content

Conversation

@jirivis
Copy link

@jirivis jirivis commented Jan 5, 2026

Hello,

This PR fixes an issue where geometries of type CurvePolygon ("polygonZ" in the attached picture, sometimes used in gpkg data, e.g., Czech Cadastral maps) were ignored or imported as empty geometries by the OGR importer.
Not_Loaded

Changes:

  • Added a check for OGR_G_HasCurveGeometry.
  • If a curve geometry is detected, it is converted to a linear approximation using OGR_G_GetLinearGeometry before processing.

This ensures that these complex polygon types are correctly imported as standard polygons.

Copy link
Member

@dg0yt dg0yt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR. Curves came with GDAL 2, and since Mapper 0.9.0, this was the minimum ;-)



if (OGR_G_HasCurveGeometry(geometry, 1)) {
OGRGeometryH linear_geom = OGR_G_GetLinearGeometry(geometry, 0, nullptr);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The ownership of the returned geometry belongs to the caller."

if (OGR_G_HasCurveGeometry(geometry, 1)) {
OGRGeometryH linear_geom = OGR_G_GetLinearGeometry(geometry, 0, nullptr);
if (linear_geom) {
OGR_F_SetGeometryDirectly(feature.get(), linear_geom);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"this function assumes ownership of the passed geometry" ✔️

}
}

OGR_G_FlattenTo2D(geometry);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIUC this is not directly related to curve geometries: "converts all Z coordinates to 0.0." Is there an actual benefit from this operation for further processing in Mapper?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello Kai,
I think that Mapper is working in 2D only? There are (not exactly in Czech) some base maps in 3D, and I think that Mapper can not import these 3D "polygonZ" features for this reason. I think that there would be some ways to import these features into Mapper. Please check the code that I sent. It is from Gemini, I am not a programmer (-:
Yes, I think that curve geometries and "polygonZ" features are two different problems.
Excuse my amateurism.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants