Skip to content
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

OGR ExportToGML creates invalid GML for CurvePolygon #7294

Closed
CodeBardian opened this issue Feb 22, 2023 · 0 comments
Closed

OGR ExportToGML creates invalid GML for CurvePolygon #7294

CodeBardian opened this issue Feb 22, 2023 · 0 comments
Assignees

Comments

@CodeBardian
Copy link

Using ExportToGML on a simple CurvePolygon consisting of one circular string and a straight segment produces an invalid GML representation. Consider this simple code snippet to reproduce the issue:

wkt = 'CURVEPOLYGON (COMPOUNDCURVE ((0 -1,0 1),CIRCULARSTRING (0 1,1 0,0 -1)))'
geom = ogr.CreateGeometryFromWkt(wkt)

gml = geom.ExportToGML(options=["FORMAT=GML32", "GMLID=test", "SPACE_INDENTATION=YES"])
print(gml)

Expected behavior and actual behavior.

Actual: The code above generates the following GML which I believe is invalid under GML 3.2 specification:

<gml:Polygon gml:id="test">
  <gml:exterior>
    <gml:CompositeCurve>
      <gml:curveMember>
        <gml:LineString>
          <gml:posList>0 -1 0 1</gml:posList>
        </gml:LineString>
      </gml:curveMember>
      <gml:curveMember>
        <gml:Curve>
          <gml:segments>
            <gml:ArcString>
              <gml:posList>0 1 1 0 0 -1</gml:posList>
            </gml:ArcString>
          </gml:segments>
        </gml:Curve>
      </gml:curveMember>
    </gml:CompositeCurve>
  </gml:exterior>
</gml:Polygon>

Expected: gml:exterior expects child elements of type gml:AbstractRing (e.g. Ring or LinearRing) not CompositeCurve. In addition the GML validation expects the gml:id attribute to be present on both curve member geometries.

This would satisfy the GML validator:

<gml:Polygon gml:id="test">
  <gml:exterior>
    <gml:Ring>
      <gml:curveMember>
        <gml:LineString gml:id="test.0">
          <gml:posList>0 -1 0 1</gml:posList>
        </gml:LineString>
      </gml:curveMember>
      <gml:curveMember>
        <gml:Curve gml:id="test.1">
          <gml:segments>
            <gml:ArcString>
              <gml:posList>0 1 1 0 0 -1</gml:posList>
            </gml:ArcString>
          </gml:segments>
        </gml:Curve>
      </gml:curveMember>
    </gml:Ring>
  </gml:exterior>
</gml:Polygon>

Operating system

Ubuntu 22.04.1, Windows 11

GDAL version and provenance

3.4.1 (within QGIS 3.22)

@rouault rouault self-assigned this Feb 22, 2023
@rouault rouault closed this as completed in a7f5fcb Mar 5, 2023
rouault added a commit that referenced this issue Mar 5, 2023
GML export: fix CurvePolygon export of CompoundCurve and CircularString child elements (fixes #7294)
rouault added a commit that referenced this issue Mar 5, 2023
rouault added a commit that referenced this issue Mar 5, 2023
[Backport release/3.6] GML export: fix CurvePolygon export of CompoundCurve and CircularString child elements (fixes #7294)
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

No branches or pull requests

2 participants