Skip to content

Commit

Permalink
GML2OGRGeometry: report gml:id of geometry in error messages
Browse files Browse the repository at this point in the history
Refs #11582
  • Loading branch information
rouault committed Jan 6, 2025
1 parent 44ff97a commit 54b36b0
Show file tree
Hide file tree
Showing 3 changed files with 261 additions and 210 deletions.
23 changes: 23 additions & 0 deletions autotest/ogr/ogr_gml_geom.py
Original file line number Diff line number Diff line change
Expand Up @@ -2388,6 +2388,29 @@ def test_gml_CircleByCenterPoint_srs_geog_uom_m_km():
ogrtest.check_feature_geometry(geom1, geom2)


###############################################################################
# Test GML CircleByCenterPoint with unhandled uom


def test_gml_CircleByCenterPoint_srs_geog_unnhandled_uom():

gml = '<gml:CircleByCenterPoint gml:id="geom_id" srsName="urn:ogc:def:crs:EPSG::4326"><gml:pos>49 2</gml:pos><gml:radius uom="unhandled">2000</gml:radius></gml:CircleByCenterPoint>'
with gdaltest.disable_exceptions(), gdal.quiet_errors():
ogr.CreateGeometryFromGML(gml)
assert (
gdal.GetLastErrorMsg()
== "GML geometry id='geom_id': Unhandled distance unit 'unhandled' in attribute 'radius'"
)

gml = '<gml:CircleByCenterPoint srsName="urn:ogc:def:crs:EPSG::4326"><gml:pos>2 49</gml:pos><gml:radius uom="unhandled">2000</gml:radius></gml:CircleByCenterPoint>'
with gdaltest.disable_exceptions(), gdal.quiet_errors():
ogr.CreateGeometryFromGML(gml)
assert (
gdal.GetLastErrorMsg()
== "Unhandled distance unit 'unhandled' in attribute 'radius'"
)


###############################################################################
# Test compound curve of ArcByCenterPoint whose ends don't exactly match
# with ends of neighbouring curves, as found in some AIXM files
Expand Down
Loading

0 comments on commit 54b36b0

Please sign in to comment.