jordoncm / kml-samples

Automatically exported from code.google.com/p/kml-samples
5 stars 0 forks source link

KML becomes invalid wrt KML 2.2 schema when saving/exporting already valid KML #292

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
When Google Earth exports or saves KML the order of elements in LookAt tag 
are reverted to listed order in KML 2.1 spec and is no longer valid wrt 
KML 2.2 XML schema whose namespace the KML indicates.

Which products are affected?

Google Earth 5.0

What steps will reproduce the problem?

1. Open any valid KML document with LookAt tag (e.g. original-valid.kml)
2. Either Select "Save As Place.." or "Copy" to export KML locally. See
save-invalid.kml.

Order of tags now as the "listed" order from KML 2.1 spec and fails to 
validate against KML 2.2 XML Schema.

ERROR: SAXParseException org.xml.sax.SAXParseException: cvc-complex-
type.2.4.a: Invalid content was found starting with element 'tilt'. One 
of '{"http://www.opengis.net/kml/2.2":altitudeModeGroup, "http://www.opengi
s.net/kml/2.2":LookAtSimpleExtensionGroup, "http://www.opengis.net/kml/2.2"
:LookAtObjectExtensionGroup}' is expected. 
Line: 18, column: 13
18: <tilt>***65.00146082207077</tilt>

What is the expected output or behavior? What do you see instead?

Expected Google Earth output to be a valid KML 2.2 document.

What application versions (if any) are you using?

Google Earth 5.0.11733.9347

Which operating systems and browsers are affected?

Microsoft Windows XP but expect all OS versions are affected

Please provide any additional information (code snippets/links) below.

source: http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd

<schema xmlns="http://www.w3.org/2001/XMLSchema"
  xmlns:kml="http://www.opengis.net/kml/2.2"
...
<complexType name="LookAtType" final="#all">
    <complexContent>
      <extension base="kml:AbstractViewType">
        <sequence>
          <element ref="kml:longitude" minOccurs="0"/>
          <element ref="kml:latitude" minOccurs="0"/>
          <element ref="kml:altitude" minOccurs="0"/>
          <element ref="kml:heading" minOccurs="0"/>
          <element ref="kml:tilt" minOccurs="0"/>
          <element ref="kml:range" minOccurs="0"/>
...

KML 2.1 LookAt type definition:

  <complexType name="LookAtType" final="#all">
    <complexContent>
      <extension base="kml:ObjectType">
        <all>
          <element name="longitude" type="kml:angle180".../>
          <element name="latitude"  type="kml:angle90".../>
          <element name="altitude"  type="double".../>
          <element name="range"     type="double" minOccurs="0"/>
          <element name="tilt"      type="kml:anglepos90".../>
          <element name="heading"   type="kml:angle360".../>
...

Example: original-valid.kml

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
    <Placemark id="pintxo">
      <name>Pintxo</name>
      <LookAt>
        <longitude>-122.080997310238</longitude>
        <latitude>37.41924758345683</latitude>
        <heading>-147.0765758373652</heading>
        <tilt>65.00146082207077</tilt>
        <range>46.77868444427536</range>
      </LookAt>
      <Point>
        <coordinates>-122.080997310238,37.41924758345683</coordinates>
      </Point>
    </Placemark>
</kml>

== save-invalid.kml ==

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2"
xmlns:gx="http://www.google.com/kml/ext/2.2"
xmlns:kml="http://www.opengis.net/kml/2.2"
xmlns:atom="http://www.w3.org/2005/Atom">
<Placemark id="pintxo">
    <name>Pintxo</name>
    <LookAt>
        <longitude>-122.080997310238</longitude>
        <latitude>37.41924758345683</latitude>
        <altitude>0</altitude>
        <range>46.77868444427536</range>
        <tilt>65.00146082207077</tilt>
        <heading>-147.0765758373652</heading>
    </LookAt>
    <Point>
        <coordinates>-122.080997310238,37.41924758345683,0</coordinates>
    </Point>
</Placemark>
</kml>

Original issue reported on code.google.com by gjmath...@gmail.com on 17 Aug 2009 at 3:12

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
Bug still exists as of Google Earth 5.1.3533.1731 (Windows version)
Build Date: Nov 12, 2009

Original comment by gjmath...@gmail.com on 14 Dec 2009 at 4:50

GoogleCodeExporter commented 8 years ago
This is probably a duplicate of issue#172

Original comment by j...@gavia.dk on 3 Jun 2010 at 7:33

GoogleCodeExporter commented 8 years ago
Problem fixed in Google Earth 5.2.1.1329 (beta) at least verified in Windows 
version.

Original comment by gjmath...@gmail.com on 15 Jun 2010 at 4:42

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
This issue should be closed. No longer an issue.

Original comment by kml4earthguy on 27 Feb 2012 at 8:31