从Maps导出的KML无法针对其自己的架构进行验证

时间:2015-05-20 03:11:44

标签: validation google-maps xsd kml google-earth

我将地球模型导入“我的地图”,然后将其导出到KMZ。我解压缩了KMZ并通过验证器(XmlValidator)在http://schemas.opengis.net/kml/2.2.0/ogckml22.xsd处对XSD运行了生成的doc.kml。

回应?

C:\Users\Bugmagnet\Downloads\XmlValidate-master>bin\xv.bat -v -kmz ..\doc.kml

Check: ..\doc.kml
http://www.opengis.net/kml/2.2
ERROR: SAXParseException org.xml.sax.SAXParseException; lineNumber: 3319; columnNumber: 38; cvc-complex-type.2.4.a: 
Invalid content was found starting with element 'Style'. One of '{"http://www.opengis.net/kml/2.2":AbstractFeatureGroup, "http://www.opengis.net/kml/2.2":DocumentSimpleExtensionGroup, "http://www.opengis.net/kml/2.2":DocumentObjectExtensionGroup}' is expected.
Line: 3319, column: 38
3319: <Style id="line-000000-1-normal">***
ERROR: SAXParseException org.xml.sax.SAXParseException; lineNumber: 3319; columnNumber: 38; cvc-complex-type.2.4.a: 
Invalid content was found starting with element 'Style'. One of '{"http://www.opengis.net/kml/2.2":AbstractFeatureGroup, "http://www.opengis.net/kml/2.2":DocumentSimpleExtensionGroup, "http://www.opengis.net/kml/2.2":DocumentObjectExtensionGroup}' is expected.
Line: 3319, column: 38

Errors: 2  Warnings: 0  Files: 1  Time: 3659 ms
Valid files 0/1 (0%)

这很重要吗?以后会咬我吗?可以或应该做什么?

我问,因为我使用从地图导出的KML作为模板,以编程方式生成KML以便在地图中使用。

奇怪的是,标记<Style id="line-000000-1-normal">的第一个实例不在第3319行,而在4022是

    <Style id='line-000000-1-normal'>
        <LineStyle>
            <color>ff000000</color>
            <width>1</width>
        </LineStyle>
    </Style>

第3199行是通过地标的一部分,在,即

        <Placemark>
            <name>LPVGDatumLutID {133}- Swan Hill</name>
            <description>
                <![CDATA[Log Provider [10] Google Analytics V3]]>
            </description>
            <styleUrl>#poly-000000-1-76</styleUrl>
            <ExtendedData>
            </ExtendedData>
            <Polygon>
                <outerBoundaryIs>
                    <LinearRing>
                        <tessellate>1</tessellate>
                        <coordinates>143.5614,-35.250688,0.0 143.555643,-35.250811,0.0 143.549902,-35.25118,0.0 143.544192,-35.251793,0.0 143.538529,-35.25264899999999,0.0 143.532928,-35.253746,0.0 143.527406,-35.25508000000001,0.0 143.521976,-35.256649,0.0 143.516654,-35.258447,0.0 143.511454,-35.26046899999999,0.0 143.506391,-35.26271100000001,0.0 143.501478,-35.265166,0.0 143.496729,-35.267828,0.0 143.492156,-35.270688,0.0 143.487773,-35.27373999999999,0.0 143.483592,-35.276975,0.0 143.479623,-35.280383,0.0 143.475877,-35.283957,0.0 143.472366,-35.287686,0.0 143.469098,-35.29155900000001,0.0 143.466083,-35.295567000000005,0.0 143.463328,-35.299698,0.0 143.460842,-35.30394100000001,0.0 143.458631,-35.308284,0.0 143.456702,-35.312715,0.0 143.455059,-35.317223,0.0 143.453707,-35.32179500000001,0.0 143.45265,-35.326419,0.0 143.451892,-35.331081,0.0 143.451433,-35.335769,0.0 143.451276,-35.34047000000001,0.0 143.45142,-35.345172,0.0 143.451866,-35.349861,0.0 143.452613,-35.354524,0.0 143.453657,-35.35914900000001,0.0 143.454998,-35.363723,0.0 143.45663,-35.368234,0.0 143.458549,-35.372668999999995,0.0 143.460751,-35.377016000000005,0.0 143.46322900000004,-35.381263000000004,0.0 143.465977,-35.385398,0.0 143.468986,-35.389411,0.0 143.47224900000003,-35.39328900000001,0.0 143.475757,-35.397023,0.0 143.479501,-35.400601,0.0 143.483469,-35.404015,0.0 143.487652,-35.407255000000006,0.0 143.492037,-35.410312,0.0 143.496612,-35.413178,0.0 143.501366,-35.415844,0.0 143.506285,-35.418304,0.0 143.511355,-35.42055,0.0 143.516563,-35.422577,0.0 143.521894,-35.424378999999995,0.0 143.527334,-35.42595,0.0 143.532867,-35.427287,0.0 143.538479,-35.428386,0.0 143.544154,-35.429244,0.0 143.549876,-35.429859,0.0 143.55563,-35.430228,0.0 143.5614,-35.430352,0.0 143.56717,-35.430228,0.0 143.572924,-35.429859,0.0 143.578646,-35.429244,0.0 143.584321,-35.428386,0.0 143.589933,-35.427287,0.0 143.595466,-35.42595,0.0 143.600906,-35.424379,0.0 143.606237,-35.422577,0.0 143.611445,-35.42055,0.0 143.616515,-35.418304000000006,0.0 143.621434,-35.41584400000001,0.0 143.626188,-35.413178,0.0 143.630763,-35.410312,0.0 143.635148,-35.407255000000006,0.0 143.639331,-35.404015,0.0 143.643299,-35.400601,0.0 143.647043,-35.397023,0.0 143.650551,-35.393289,0.0 143.653814,-35.389411,0.0 143.656823,-35.385398,0.0 143.659571,-35.381263000000004,0.0 143.662049,-35.377016000000005,0.0 143.664251,-35.372669,0.0 143.66617,-35.368234,0.0 143.667802,-35.363723,0.0 143.669143,-35.35914900000001,0.0 143.670187,-35.354524,0.0 143.670934,-35.349861000000004,0.0 143.67138,-35.345172,0.0 143.671524,-35.34047000000001,0.0 143.671367,-35.335769000000006,0.0 143.670908,-35.331081,0.0 143.67015,-35.32641900000001,0.0 143.669093,-35.321795,0.0 143.667741,-35.317223,0.0 143.666098,-35.312715,0.0 143.664169,-35.308284,0.0 143.661958,-35.30394100000001,0.0 143.659472,-35.29969799999999,0.0 143.656717,-35.295567000000005,0.0 143.653702,-35.291559,0.0 143.650434,-35.287686,0.0 143.646923,-35.283957,0.0 143.643177,-35.280383,0.0 143.639208,-35.276975,0.0 143.635027,-35.273740000000004,0.0 143.630644,-35.270688,0.0 143.626071,-35.267828,0.0 143.621322,-35.265166,0.0 143.616409,-35.262710999999996,0.0 143.611346,-35.260469,0.0 143.606146,-35.258447,0.0 143.600824,-35.256649,0.0 143.595394,-35.25508000000001,0.0 143.589872,-35.253746,0.0 143.584271,-35.25264899999999,0.0 143.57860800000003,-35.251793,0.0 143.572898,-35.25118,0.0 143.567157,-35.250811,0.0 143.5614,-35.250688,0.0</coordinates>
                    </LinearRing>
                </outerBoundaryIs>
            </Polygon>
        </Placemark>

LATER

更奇怪:我将kml导入Fusion Charts然后导出它。 KML现在在地标之前有样式信息,并且完美验证。

1 个答案:

答案 0 :(得分:1)

解决方案:首先放置样式信息。

<?xml version='1.0' encoding='UTF-8'?>
<kml xmlns='http://www.opengis.net/kml/2.2'>
    <Document>
        <name>doc</name>
        <Style id='Style2-point-1'>
            <IconStyle>
                <color>ff0000ff</color>
                <scale>1.0</scale>
                <Icon>
                    <href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png</href>
                </Icon>
            </IconStyle>
            <LabelStyle>
                <scale>0.0</scale>
            </LabelStyle>
            <BalloonStyle>
                <text>$[description]</text>
            </BalloonStyle>
        </Style>
        <Style id='Style2-point-1-hover'>
            <IconStyle>
                <color>ff0000ff</color>
                <scale>1.0</scale>
                <Icon>
                    <href>http://maps.google.com/mapfiles/kml/shapes/placemark_circle.png</href>
                </Icon>
            </IconStyle>
            <BalloonStyle>
                <text>$[description]</text>
            </BalloonStyle>
        </Style>
        <StyleMap id='Style2-point-1-map'>
            <Pair>
                <key>normal</key>
                <styleUrl>#Style2-point-1</styleUrl>
            </Pair>
            <Pair>
                <key>highlight</key>
                <styleUrl>#Style2-point-1-hover</styleUrl>
            </Pair>
        </StyleMap>
        <Placemark>
            <name>LPVGDatumLutID {11}- Canberra</name>
            <snippet/>
            <description>
                <![CDATA[<div class="googft-info-window">
<b>description:</b> Log Provider [10] Google Analytics V3<br>
<b>name:</b> LPVGDatumLutID {11}- Canberra
</div>]]></description>
            <styleUrl>#Style2-polygon-3-map</styleUrl>
            <ExtendedData/>
            <Polygon>
                <outerBoundaryIs>
                    <LinearRing>
                        <coordinates>148.836481,-35.026301,0.0 148.833751,-35.028007,0.0 148.816238,-35.040183,0.0 148.799522,-35.053091,0.0 148.783649,-35.066695,0.0 148.768662,-35.080959,0.0 148.754603,-35.095843,0.0 148.74151,-35.111308,0.0 148.729419,-35.127311,0.0 148.718365,-35.143808,0.0 148.708377,-35.160755,0.0 148.699483,-35.178105,0.0 148.691709,-35.195812,0.0 148.685076,-35.213826,0.0 148.679604,-35.2321,0.0 148.675308,-35.250581,0.0 148.672201,-35.269222,0.0 148.670291,-35.287969,0.0 148.669585,-35.306772,0.0 148.670086,-35.32558,0.0 148.671794,-35.34434,0.0 148.674704,-35.363002,0.0 148.678809,-35.381513,0.0 148.684099,-35.399824,0.0 148.69056,-35.417884,0.0 148.698174,-35.435644,0.0 148.706923,-35.453053,0.0 148.716782,-35.470065,0.0 148.727726,-35.486632,0.0 148.739723,-35.502709,0.0 148.752743,-35.518252,0.0 148.766749,-35.533217,0.0 148.781704,-35.547563,0.0 148.797566,-35.561251,0.0 148.814293,-35.574242,0.0 148.831838,-35.586501,0.0 148.850153,-35.597994,0.0 148.869187,-35.608688,0.0 148.888889,-35.618555,0.0 148.909204,-35.627566,0.0 148.930075,-35.635698,0.0 148.951446,-35.642927,0.0 148.973256,-35.649233,0.0 148.995445,-35.654599,0.0 149.017952,-35.659009,0.0 149.040715,-35.662453,0.0 149.063669,-35.664919,0.0 149.086753,-35.666401,0.0 149.104176,-35.666774,0.0 149.1099,-35.666896,0.0 149.133047,-35.666401,0.0 149.156131,-35.664919,0.0 149.179085,-35.662453,0.0 149.201848,-35.659009,0.0 149.224355,-35.654599,0.0 149.246544,-35.649233,0.0 149.268354,-35.642927,0.0 149.289725,-35.635698,0.0 149.310596,-35.627566,0.0 149.330911,-35.618555,0.0 149.350613,-35.608688,0.0 149.369647,-35.597994,0.0 149.387962,-35.586501,0.0 149.405507,-35.574242,0.0 149.422234,-35.561251,0.0 149.438096,-35.547563,0.0 149.453051,-35.533217,0.0 149.467057,-35.518252,0.0 149.480077,-35.502709,0.0 149.492074,-35.486632,0.0 149.503018,-35.470065,0.0 149.512877,-35.453053,0.0 149.521626,-35.435644,0.0 149.52924,-35.417884,0.0 149.535701,-35.399824,0.0 149.540991,-35.381513,0.0 149.545096,-35.363002,0.0 149.548006,-35.34434,0.0 149.549714,-35.32558,0.0 149.550215,-35.306772,0.0 149.549509,-35.287969,0.0 149.547599,-35.269222,0.0 149.544492,-35.250581,0.0 149.540196,-35.2321,0.0 149.537488,-35.223056,0.0 149.534724,-35.213826,0.0 149.528091,-35.195812,0.0 149.520317,-35.178105,0.0 149.511423,-35.160755,0.0 149.501435,-35.143808,0.0 149.490381,-35.127311,0.0 149.47829,-35.111308,0.0 149.465197,-35.095843,0.0 149.451138,-35.080959,0.0 149.436151,-35.066695,0.0 149.420278,-35.053091,0.0 149.403562,-35.040183,0.0 149.386049,-35.028007,0.0 149.367787,-35.016595,0.0 149.348826,-35.005979,0.0 149.329217,-34.996186,0.0 149.309014,-34.987245,0.0 149.288271,-34.979178,0.0 149.267046,-34.972008,0.0 149.245395,-34.965755,0.0 149.223377,-34.960435,0.0 149.201052,-34.956062,0.0 149.178481,-34.952648,0.0 149.155724,-34.950204,0.0 149.132843,-34.948734,0.0 149.1099,-34.948244,0.0 149.104176,-34.948367,0.0 149.086957,-34.948734,0.0 149.064076,-34.950204,0.0 149.041319,-34.952648,0.0 149.018748,-34.956062,0.0 148.996423,-34.960435,0.0 148.974405,-34.965755,0.0 148.952754,-34.972008,0.0 148.931529,-34.979178,0.0 148.910786,-34.987245,0.0 148.890583,-34.996186,0.0 148.870974,-35.005979,0.0 148.852013,-35.016595,0.0 148.836481,-35.026301,0.0</coordinates>
                    </LinearRing>
                </outerBoundaryIs>
            </Polygon>
        </Placemark>
    </Document>
</kml>
相关问题