[gdal-dev] ExportToGML with compound CRS
Joep Keijsers
joep.keijsers at sogelink.com
Fri Apr 17 04:42:35 PDT 2026
Thanks for the quick patch! After building from the PR branch, I can confirm that it correctly returns the compound CRS for both approaches.
Joep
________________________________
From: Rahkonen Jukka <jukka.rahkonen at maanmittauslaitos.fi>
Sent: 15 April 2026 17:28
To: Joep Keijsers <joep.keijsers at sogelink.com>; gdal-dev at lists.osgeo.org <gdal-dev at lists.osgeo.org>; Even Rouault <even.rouault at spatialys.com>
Subject: Re: [gdal-dev] ExportToGML with compound CRS
[You don't often get email from jukka.rahkonen at maanmittauslaitos.fi. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
Hi
Even made a fix already but here is a command for testing with the old school CLI.
ogr2ogr -f gml -a_srs EPSG:5973 compound.gml :memory: -sql "select 1 as id, st_geomfromtext('POINTZ (1 1 1)') as geom" -nln test
"boundedBy" seems to receive
srsName="urn:ogc:def:crs:EPSG::5973 but the geometry itself srsName="urn:ogc:def:crs:EPSG::11023"
-Jukka Rahkonen-
________________________________________
Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org> käyttäjän Even Rouault via gdal-dev <gdal-dev at lists.osgeo.org> puolesta
Lähetetty: Keskiviikko 15. huhtikuuta 2026 18.25
Vastaanottaja: Joep Keijsers <joep.keijsers at sogelink.com>; gdal-dev at lists.osgeo.org <gdal-dev at lists.osgeo.org>
Aihe: Re: [gdal-dev] ExportToGML with compound CRS
HUOM! Ulkoinen lähettäjä. Älä avaa linkkejä tai liitteitä, ellet tunnista lähettäjää.
OBS! Extern avsändare. Öppna inte länkar eller bilagor om du inte känner igen avsändaren.
NOTE! External sender. Do not open links or attachments unless you recognize the sender.
Hi,
no other workaround but applying
https://github.com/OSGeo/gdal/pull/14367 (or post patching the output)
Even
Le 15/04/2026 à 16:53, Joep Keijsers via gdal-dev a écrit :
> Greetings,
>
> I'm trying to export a geometry object to GML using the Python API. The geometry has a compound CRS (EPSG:5973). When exporting to GML, the vertical component of the compound CRS is dropped, although the Z-values are still there. For example:
>
> from osgeo import ogr, osr
>
> # Create geometry from WKT string
> srs = osr.SpatialReference()
> srs.ImportFromEPSG(5973)
> wkt = "POINT (30 10 5)"
> geometry = ogr.CreateGeometryFromWkt(wkt, srs)
>
> # Export to GML
> xml = geometry.ExportToGML(options=['FORMAT=GML32', 'SRSDIMENSION_LOC=GEOMETRY', 'SRSNAME_FORMAT=SHORT', 'GMLID=TestPoint-1'])
> print(xml)
>
> ... which returns EPSG:11023 instead of EPSG:5973:
>
> <gml:Point srsName="EPSG:11023" srsDimension="3" gml:id="TestPoint-1"><gml:pos>30 10 5</gml:pos></gml:Point>
>
> I believe this EPSG code change happens in this line: https://github.com/OSGeo/gdal/blob/30e7918f245022983d84f93f1a53641fd50337ed/ogr/ogr2gmlgeometry.cpp#L562.
>
> Is there a way to keep the compound CRS in the GML output?
>
> Version info: gdal 3.12.3
>
> Thanks!
>
> Joep
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev
--
http://www.spatialys.com/
My software is free, but my time generally not.
Highly recommend OxiGDAL if you want to live in the 21th century and cure Bixonimania
_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/gdal-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20260417/14a77a7f/attachment-0001.htm>
More information about the gdal-dev
mailing list