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

GML: gml:CircleByCenterPoint is converted to WKT which is no longer compliant #11750

Closed
heidivanparys opened this issue Jan 29, 2025 · 0 comments · Fixed by #11755
Closed

GML: gml:CircleByCenterPoint is converted to WKT which is no longer compliant #11750

heidivanparys opened this issue Jan 29, 2025 · 0 comments · Fixed by #11755
Assignees

Comments

@heidivanparys
Copy link
Contributor

What is the bug?

When reading a GML file containing a gml:CircleByCenterPoint geometry, the geometry is reported as a CURVEPOLYGON with a CIRCULARSTRING, consisting of three points, the first point being equal to the third point.

This is compliant with earlier editions of the SQL/MM standard (ISO/IEC 13249-3), as e.g. documented in the PostGIS documentation, https://postgis.net/docs/manual-3.5/using_postgis_dbmanagement.html#CircularString.

In ISO/IEC 13249-3:2016, the current version of the standard, an ST_CircularCurve with equal segment start and end point is no longer permitted, Instead, type ST_Circle is introduced to deal with circles. This is described in ISO/IEC 13249-3:2016 Annex D Incompatibilities with ISO/IEC 13249-3:2011.

The WKT reported when converting a gml:CircleByCenterPoint geometry, will fail in e.g.

It would be better if a gml:CircleByCenterPoint would be converted to a CURVEPOLYGON with an CIRCULARSTRING defined by 5 points. That encoding will be recognized by more databases and other tools, hence increasing interoperability.

I noticed this issue with the WKT encoding of circles when reading GML. The underlying problem as described above possibly occurs in other drivers, I did not investigate that.

Steps to reproduce the issue

The following geometry:

<gml:Polygon srsName="http://www.opengis.net/def/crs/EPSG/0/25832"
             srsDimension="2">
    <gml:exterior>
        <gml:Ring>
            <gml:curveMember>
                <gml:Curve>
                    <gml:segments>
                        <gml:CircleByCenterPoint numArc="1">
                            <gml:pos>1 2</gml:pos>
                            <gml:radius uom="m">2</gml:radius>
                        </gml:CircleByCenterPoint>
                    </gml:segments>
                </gml:Curve>
            </gml:curveMember>
        </gml:Ring>
    </gml:exterior>
</gml:Polygon>

is reported as CURVEPOLYGON (CIRCULARSTRING (-1 2,3 2,-1 2)).

SELECT sdo_geom.VALIDATE_GEOMETRY_WITH_CONTEXT(sdo_util.FROM_WKTGEOMETRY('CURVEPOLYGON (CIRCULARSTRING (-1 2,3 2,-1 2))') , 0,005) FROM dual; fails with ORA-13346.

A better WKT representation would e.g. be CURVEPOLYGON (CIRCULARSTRING (-1 2,1 0,3 2,1 4,-1 2)).

Image

Relevant code (I think):

gdal/ogr/gml2ogrgeometry.cpp

Lines 2042 to 2057 in abaccaa

auto poCC = std::make_unique<OGRCircularString>();
p.setX(dfCenterX - dfRadius);
p.setY(dfCenterY);
poCC->addPoint(&p);
p.setX(dfCenterX + dfRadius);
p.setY(dfCenterY);
poCC->addPoint(&p);
p.setX(dfCenterX - dfRadius);
p.setY(dfCenterY);
poCC->addPoint(&p);
if (bInvertedAxisOrder)
poCC->swapXY();
return poCC;
}

Versions and provenance

GDAL 3.10.1, released 2025/01/08, installed from OSGeo4W.

Additional context

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants