-
Notifications
You must be signed in to change notification settings - Fork 127
Fix: Flatten OGR curve geometries (CurvePolygon) to polygons before import #2460
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
dg0yt
left a comment
There was a problem hiding this 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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
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.