Fix: Flatten OGR curve geometries (CurvePolygon) to polygons before import#2460
Fix: Flatten OGR curve geometries (CurvePolygon) to polygons before import#2460jirivis wants to merge 1 commit intoOpenOrienteering:masterfrom
Conversation
dg0yt
left a comment
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
"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); |
There was a problem hiding this comment.
"this function assumes ownership of the passed geometry" ✔️
| } | ||
| } | ||
|
|
||
| OGR_G_FlattenTo2D(geometry); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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.Changes:
OGR_G_HasCurveGeometry.OGR_G_GetLinearGeometrybefore processing.This ensures that these complex polygon types are correctly imported as standard polygons.