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 writer: FeatureCollection's envelope SRS (3.9.1 regression) #10332

Closed
cyril1929 opened this issue Jun 27, 2024 · 3 comments · Fixed by #10334
Closed

gml writer: FeatureCollection's envelope SRS (3.9.1 regression) #10332

cyril1929 opened this issue Jun 27, 2024 · 3 comments · Fixed by #10334
Assignees

Comments

@cyril1929
Copy link

cyril1929 commented Jun 27, 2024

What is the bug?

When we produce a GML from a GeoJson with a SQL dialect, the gml:Envelope in the response no longer contains SRS.

The srs is however always present if no sql query is put.

By the way, not having srs reverses the axes.

I don't think this change in behavior was intentional?

Steps to reproduce the issue

ogr2ogr -sql "SELECT * FROM input" -dialect sqlite -f GML output.gml input.json

return :

...
<gml:boundedBy>
    <gml:Envelope>
        <gml:lowerCorner>0 -1369</gml:lowerCorner>
        <gml:upperCorner>1138 -1</gml:upperCorner>
    </gml:Envelope>
</gml:boundedBy>
...

while :

ogr2ogr -sql "" -dialect sqlite -f GML output.gml input.json

return :

...
<gml:boundedBy>
    <gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326">
        <gml:lowerCorner>-1369 0</gml:lowerCorner>
        <gml:upperCorner>-1 1138</gml:upperCorner>
    </gml:Envelope>
</gml:boundedBy>
...

Versions and provenance

The regression appeared in version 3.9.1.
No worries in version 3.9.0 and earlier.

Additional context

No response

@cyril1929 cyril1929 changed the title gml envelope regression gml envelope SRS regression Jun 27, 2024
@jratike80
Copy link
Collaborator

jratike80 commented Jun 27, 2024

I can confirm with GDAL 3.10.0dev-a44e40295c, released 2024/06/21 (OSGeo4W).

Also the name of the geometry has changed.
Was: <ogr:geometryProperty>
Is now: <ogr:GEOMETRY>

This srsName drop affects the FeatureCollection level Envelope. The featureMembers still have Envelopes with srsName - and with Lat-Lon axis order.

<ogr:FeatureCollection
     gml:id="aFeatureCollection"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xsi:schemaLocation="http://ogr.maptools.org/ srs3.xsd"
     xmlns:ogr="http://ogr.maptools.org/"
     xmlns:gml="http://www.opengis.net/gml/3.2">
  <gml:boundedBy><gml:Envelope><gml:lowerCorner>23.5343338 63.1870744</gml:lowerCorner><gml:upperCorner>23.5511729 63.1915115</gml:upperCorner></gml:Envelope></gml:boundedBy>
                                                                                                                                                                              
  <ogr:featureMember>
    <ogr:SELECT gml:id="SELECT.0">
      <gml:boundedBy><gml:Envelope srsName="urn:ogc:def:crs:EPSG::4326"><gml:lowerCorner>63.1870744 23.5454641</gml:lowerCorner><gml:upperCorner>63.1871252 23.5455768</gml:upperCorner></gml:Envelope></gml:boundedBy>

@rouault rouault self-assigned this Jun 27, 2024
rouault added a commit to rouault/gdal that referenced this issue Jun 27, 2024
…(3.9.1 regression)

Fixes OSGeo#10332

Was caused by the fix 3674ec7 for OSGeo#10071

The regression mostly occurs when writing a GML file using ogr2ogr when
the source layer has a named geometry column, e.g if the source is a
GeoPackage or if using -sql
The problem was acutally latent and also could have occured before 3.9.1 if using
CreateLayer() without a SRS + CreateGeomField()
@rouault
Copy link
Member

rouault commented Jun 27, 2024

Also the name of the geometry has changed.

That's expected ant not an issue, and not a new behaviour. This is due to SQL SQLite layer reporting a name GEOMETRY geometry field. Direct translation from GeoJSON which has a unnamed/empty geometry field fallbacks to using "geometryProperty" in the GML writer.

For the SRS issue, fix in #10334

A workaround is to do a ogr2ogr to a format like GeoJSON (or shapefile, but not GeoPackage, PostGIS, etc) that has not a named geometry field using the -sql clause, and then ogr2ogr that temporary GeoJSON file to GML

@rouault rouault changed the title gml envelope SRS regression gml writer: FeatureCollection's envelope SRS (3.9.1 regression) Jun 27, 2024
@cyril1929
Copy link
Author

Thanks !

rouault added a commit that referenced this issue Jul 6, 2024
…(3.9.1 regression)

Fixes #10332

Was caused by the fix 3674ec7 for #10071

The regression mostly occurs when writing a GML file using ogr2ogr when
the source layer has a named geometry column, e.g if the source is a
GeoPackage or if using -sql
The problem was acutally latent and also could have occured before 3.9.1 if using
CreateLayer() without a SRS + CreateGeomField()
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

Successfully merging a pull request may close this issue.

3 participants