kml google extensions not in schema

风格不统一 提交于 2021-02-19 03:05:49

问题


The jurisdiction I live in published data using a Google globe. The kml file they point to contains

<?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">
         <gx:GoogleMapsEngineLink>
         <href>http://globe.information.qld.gov.au/qldglobe</href>
     </gx:GoogleMapsEngineLink>
</kml>

I can't find any reference to the gx:GoogleMapsEngineLink in any public documentation and I am having trouble using that with other standard kml, for example a Place. I'd like a kml that pens this government globe and also adds a Place.

I'd like to be able to add this Place to the Above kml (ie. one kml file)

<?xml version='1.0' encoding='UTF-8'?>
<kml xmlns="http://www.opengis.net/kml/2.2"
<Placemark>
<description>Some nice place</description>
<Point>
<coordinates>153.0064595002,-27.4811714996,0</coordinates>
</Point>
<Style>
    <LabelStyle>
     <color>ff7fffff</color>
    </LabelStyle>
</Style>
</Placemark>
</kml>

回答1:


The Google KML extensions can be found in Google's KML documentation: https://developers.google.com/kml/documentation/kmlreference#kmlextensions

The complete XML schema for elements in this extension namespace is located at http://developers.google.com/kml/schema/kml22gx.xsd.

gx:GoogleMapsEngineLink is not a documented part of the Google KML extensions as defined in the namespace http://www.google.com/kml/ext/2.2.

Why don't you create a KMZ file with a root KML file and the gx:GoogleMapsEngineLink loaded in a KML embedded in the KMZ file as an auxiliary file.

Root KML file doc.kml:

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
    <Document>
        <NetworkLink>
            <Link>
                <href>engine.kml</href>
            </Link>
        </NetworkLink>

        <Placemark>
            <description>Some nice place</description>
            <Point>
                <coordinates>153.0064595002,-27.4811714996,0</coordinates>
            </Point>
            <Style>
                <LabelStyle>
                    <color>ff7fffff</color>
                </LabelStyle>
            </Style>
        </Placemark>
    </Document>
</kml>

And the google engine KML (engine.kml) like this:

engine.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">

    <gx:GoogleMapsEngineLink>
        <href>http://globe.information.qld.gov.au/qldglobe</href>
    </gx:GoogleMapsEngineLink>

</kml>

Update: Since the <gx:GoogleMapsEngineLink> is special and undocumented it doesn't work as would other KML elements so it cannot appear as child to <Document> element or as target to <NetworkLink>. Likewise, if this element appears at the root level with a Document or Placemark following those Features are ignored.

Google announced it will discontinue the Google Maps Engine product in January 2016.




回答2:


I could not get my KML to Validate as valid XML because my KML includes a gx (Google Extension) tag (<gx:Tour> for example), and www.google.com/kml/ext/2.2/ is a 404 error. Here is what I finally got to validate after an hour of trial and error:

<?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"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.google.com/kml/ext/2.2 http://developers.google.com/kml/schema/kml22gx.xsd">

I don't really know what I'm doing exactly, so I can't make any claims this is a kosher or legitimate fix, or whether that's all necessary. But it's the only way I could get it to validate.



来源:https://stackoverflow.com/questions/15801152/kml-google-extensions-not-in-schema

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!