Skip to content

KML driver changed a field named "ID" #13590

@juneidy

Description

@juneidy

What is the bug?

I am debugging an issue with KML file where if I have a field called ID, the type has been incorrectly deduced between gdal version 3.9.3 and 3.10.0.

Steps to reproduce the issue

My KML file:

<?xml version="1.0" encoding="utf-8" ?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document id="root_doc">
<Schema name="hello2" id="hello2">
        <SimpleField name="Name" type="string"></SimpleField>
        <SimpleField name="Description" type="string"></SimpleField>
        <SimpleField name="ID" type="int"></SimpleField>
</Schema>
<Folder><name>hello2</name>
  <Placemark>
        <name>WAKE ISLAND</name>
        <Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
        <ExtendedData><SchemaData schemaUrl="#hello2">
                <SimpleData name="ID">32</SimpleData>
        </SchemaData></ExtendedData>
      <Polygon><outerBoundaryIs><LinearRing><coordinates>166.4359,19.504367 166.4699,19.509833 166.5086,19.4887 166.50975,19.4668 166.49335,19.4504 166.4617,19.441 166.4277,19.452733 166.4183,19.474633 166.4359,19.504367</coordinates></LinearRing></outerBoundaryIs></Polygon>
  </Placemark>
  <Placemark>
        <name>MONTSERRAT</name>
        <description>PLYMOUTH</description>
        <Style><LineStyle><color>ff0000ff</color></LineStyle><PolyStyle><fill>0</fill></PolyStyle></Style>
        <ExtendedData><SchemaData schemaUrl="#hello2">
                <SimpleData name="ID">54</SimpleData>
        </SchemaData></ExtendedData>
      <Polygon><outerBoundaryIs><LinearRing><coordinates>-62.22015,16.730367 -62.20585,16.696633 -62.21155,16.664167 -62.22685,16.659067 -62.2555,16.6648 -62.26695,16.6839 -62.26695,16.715733 -62.25455,16.7361 -62.2431,16.738 -62.2345,16.737367 -62.22015,16.730367</coordinates></LinearRing></outerBoundaryIs></Polygon>
  </Placemark>
</Folder>
</Document></kml>
$ docker run -it --rm -v $PWD:/foo -w /foo ghcr.io/osgeo/gdal:ubuntu-full-3.10.0 ogrinfo -so hello.kml hello2
INFO: Open of `hello.kml'
      using driver `LIBKML' successful.

Layer name: hello2
Geometry: Unknown (any)
Feature Count: 2
Extent: (-62.266950, 16.659067) - (166.509750, 19.509833)
Layer SRS WKT:
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
id: String (0.0)
Name: String (0.0)
description: String (0.0)
timestamp: DateTime
begin: DateTime
end: DateTime
altitudeMode: String (0.0)
tessellate: Integer (0.0)
extrude: Integer (0.0)
visibility: Integer (0.0)
drawOrder: Integer (0.0)
icon: String (0.0)

Versions and provenance

GDAL 3.10.0, released 2024/11/01
In Ubuntu docker image: ghcr.io/osgeo/gdal:ubuntu-full-3.10.0

Additional context

Gdal 3.9.3 seems to work fine:

$ docker run -it --rm -v $PWD:/foo -w /foo ghcr.io/osgeo/gdal:ubuntu-full-3.9.3 ogrinfo -so hello.kml hello2
INFO: Open of `hello.kml'
      using driver `LIBKML' successful.

Layer name: hello2
Geometry: Unknown (any)
Feature Count: 2
Extent: (-62.266950, 16.659067) - (166.509750, 19.509833)
Layer SRS WKT:
GEOGCRS["WGS 84",
    DATUM["World Geodetic System 1984",
        ELLIPSOID["WGS 84",6378137,298.257223563,
            LENGTHUNIT["metre",1]]],
    PRIMEM["Greenwich",0,
        ANGLEUNIT["degree",0.0174532925199433]],
    CS[ellipsoidal,2],
        AXIS["geodetic latitude (Lat)",north,
            ORDER[1],
            ANGLEUNIT["degree",0.0174532925199433]],
        AXIS["geodetic longitude (Lon)",east,
            ORDER[2],
            ANGLEUNIT["degree",0.0174532925199433]],
    ID["EPSG",4326]]
Data axis to CRS axis mapping: 2,1
Name: String (0.0)
description: String (0.0)
timestamp: DateTime
begin: DateTime
end: DateTime
altitudeMode: String (0.0)
tessellate: Integer (0.0)
extrude: Integer (0.0)
visibility: Integer (0.0)
drawOrder: Integer (0.0)
icon: String (0.0)
ID: Integer (0.0)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions