Bug report #3272

KML export is malformed

Added by onyxfish - over 13 years ago. Updated over 8 years ago.

Status:Closed
Priority:Low
Assignee:-
Category:Project Loading/Saving
Affected QGIS version:master Regression?:No
Operating System:OS X Easy fix?:No
Pull Request or Patch supplied:No Resolution:fixed/implemented
Crashes QGIS or corrupts data:No Copied to github as #:13332

Description

The first four rows of an layer exported as KML read as follows:

<?xml version="1.0" encoding="utf-8" ?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document><Folder><name>test</name>
<Schema name="test" id="test">
...

The <Schema> element is not a valid child of <Folder>. It should be a child of <Document>.

As documented here:
http://code.google.com/apis/kml/documentation/kmlreference.html#folder
http://code.google.com/apis/kml/documentation/kmlreference.html#schema

This doesn't by itself cause any rendering issues, but if a <Style> declaration is added after the <Schema> (which is normally correct) the styles will fail to render.

History

#1 Updated by barryrowlingson - over 13 years ago

There's a handy KML validator here:

http://www.kmlvalidator.org/validate.htm

which spots the Schema nesting problem and also points me to the OGC standard which says the type has to be like type="xsd:string", whereas qgis is generating type="string". Fixer might want to fix this too. Even the Google KML examples don't have this!

#2 Updated by Giovanni Manghi over 12 years ago

  • Target version changed from Version 1.7.0 to Version 1.7.4

#3 Updated by Paolo Cavallini about 12 years ago

  • Crashes QGIS or corrupts data set to No
  • Target version changed from Version 1.7.4 to Version 1.8.0
  • Affected QGIS version set to master

#4 Updated by Paolo Cavallini over 11 years ago

  • Target version changed from Version 1.8.0 to Version 2.0.0

#5 Updated by Jürgen Fischer almost 10 years ago

  • Target version changed from Version 2.0.0 to Future Release - Lower Priority

#6 Updated by Médéric RIBREUX over 8 years ago

  • Pull Request or Patch supplied set to No
  • Status changed from Open to Closed
  • Assignee deleted (nobody -)
  • % Done changed from 0 to 100
  • Resolution set to fixed/implemented

Hello, bug triage...

the KML export is now made with OGR and Schema is not a child of Folder anymore:

<?xml version="1.0" encoding="utf-8" ?>
<kml xmlns="http://www.opengis.net/kml/2.2">
<Document id="root_doc">
<Schema name="testkml" id="testkml">
    <SimpleField name="ID" type="int"></SimpleField>
    <SimpleField name="POLY_NUM_A" type="float"></SimpleField>
    <SimpleField name="POLY_ST_A" type="string"></SimpleField>
</Schema>
<Folder><name>testkml</name>

I am closing this bug.

Also available in: Atom PDF