#5208 closed defect (fixed)
Syntetic field name considered as real
Reported by: | strk | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | 1.10.1 |
Component: | OGR_SF | Version: | 1.10.0 |
Severity: | normal | Keywords: | kml ogr2ogr |
Cc: |
Description
When converting an SQL query with a "Name" field to KML format, ogr2ogr renames the "Name" column to "name2" because (it says) a field named "name" already exists. But that field is really not in the query.
$ ogr2ogr -f kml /dev/stdout "PG:" -sql "SELECT 'a' as name" Warning 1: Field 'name' already exists. Renaming it as 'name2'
The resulting KML has no "Name" described in the "ExtendedData" schema in the placemark.
Full result:
<?xml version="1.0" encoding="utf-8" ?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document><Folder><name>sql_statement</name> Warning 1: Field 'name' already exists. Renaming it as 'name2' <Placemark> <ExtendedData><SchemaData schemaUrl="#sql_statement"> <SimpleData name="name2">a</SimpleData> </SchemaData></ExtendedData> </Placemark> </Folder> <Schema name="sql_statement" id="sql_statement"> <SimpleField name="Name" type="string"></SimpleField> <SimpleField name="Description" type="string"></SimpleField> <SimpleField name="name2" type="string"></SimpleField> </Schema> </Document></kml>
It used to work differently in 1.9.2
This _may_ be a duplicate of #4988 but I'm not sure as there isn't enough information for me in that ticket
Change History (4)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Keywords: | kml ogr2ogr added |
---|---|
Milestone: | → 1.10.1 |
Resolution: | → fixed |
Status: | new → closed |
Seen in the context of this ticket, but not directly the issue exposed :
trunk(r26346) and branches/1.10(r26347): "KML: in writing mode, avoid defining an extending schema for the name and description fields (related to #5208)"
trunk r26348 "ogr2ogr: check that detection of duplicated field names is case insensitive (#5208)" --> autotest only, since the fix itself existed in trunk since r26141
branches/1.10 r26349 "ogr2ogr: make detection of duplicated field names case insensitive (#5208)"
After those fixes, the output is now :
$ ogr2ogr -f kml /dev/stdout PG:dbname=autotest -sql "SELECT 'a' as name" <?xml version="1.0" encoding="utf-8" ?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document><Folder><name>sql_statement</name> <Placemark> <name>a</name> </Placemark> </Folder> </Document></kml>
and
$ ogr2ogr -f kml /dev/stdout PG:dbname=autotest -sql "SELECT 'a' as name, 'b' as another_field" <?xml version="1.0" encoding="utf-8" ?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document><Folder><name>sql_statement</name> <Placemark> <name>a</name> <ExtendedData><SchemaData schemaUrl="#sql_statement"> <SimpleData name="another_field">b</SimpleData> </SchemaData></ExtendedData> </Placemark> </Folder> <Schema name="sql_statement" id="sql_statement"> <SimpleField name="another_field" type="string"></SimpleField> </Schema> </Document></kml>
comment:3 by , 11 years ago
This still sounds bogus:
ogr2ogr -f kml /dev/stdout PG: -sql "SELECT 'a' as name, 'b' as \"Name\"" <?xml version="1.0" encoding="utf-8" ?> <kml xmlns="http://www.opengis.net/kml/2.2"> <Document><Folder><name>sql_statement</name> <Placemark> </Placemark> </Folder> </Document></kml>
Needs another ticket ?
This is the output from 1.9.2:
Which is right and which is wrong ?