BalloonStyle中的KML实体替换在GoogleMaps中失败,但在GoogleEarth中失败 [英] KML Entity Replacement in BalloonStyle Fails in GoogleMaps, But Not GoogleEarth

查看:97
本文介绍了BalloonStyle中的KML实体替换在GoogleMaps中失败,但在GoogleEarth中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

从GEarth与Google Maps调试KML花费了太多时间. 有人可以给我一个提示,为什么下面的实体替换"在GE中可以正常运行,而在GMaps中却无法运行.

Spent way too many hours debugging KML from within GEarth vs. Google Maps. Can someone give me a hint on why the following 'Entity Replacement' below works fine in GE but fails in GMaps.

我运行了XMLValidate,文件运行良好,但是[CDATA]中的标签不会被GoogleMaps API取代,仅在GEarth中即可.我在 BalloonStyle实体替换上阅读了最佳实践KML文档,并且麻木了 OGC KML 2.2标准中的说明,并对其进行了调整和修整,但是我仍然难住.在以下情况下,我无法让实体替换在GMaps API中工作.

I ran XMLValidate and the file is fine, but the tags in [CDATA] don't get replaced by GoogleMaps API, only in GEarth. I read the Best Practices KML docs on BalloonStyle entity replacement, and the mind-numbing description in the OGC KML 2.2 standard and tuned and trimmed the file, but I'm still stumped. I can't get Entity Replacement to work in GMaps API in the case below.

有什么想法吗? -谢谢

Any ideas? -Thanks

<?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">
    <Document>
        <name>ParcelsJoinedx.kml</name>
        <Style id="outline">
            <PolyStyle>
                <color>00ff0000</color>
                <fill>1</fill>
                <outline>1</outline>
            </PolyStyle>
            <BalloonStyle>
                <bgColor>ffffffff</bgColor>
                <text>
                <![CDATA[
                    <head>
                    <title></title>
                    <STYLE TYPE="text/css">
                    <!-- TD{font-family: Arial; font-size: 9pt;} --->
                    </STYLE>
                    </head>
                    <body>
                      <table >
                      <tr><td valign='top'><font color="#aa0000">$[ParcelJoined/Location/displayName]:</font></td><td>$[ParcelJoined/Location]</td>
                      <tr><td><font color="#aa0000">$[ParcelJoined/ParcelID/displayName]:</font></td><td>$[ParcelJoined/ParcelID]</td>
                     </tr></table>
                     </body>
                     ]]>
                 </text>
            </BalloonStyle>
        </Style>
        <Schema name="ParcelJoined" id="ParcelJoinedID">
            <SimpleField type="string" name="Name"></SimpleField>
            <SimpleField type="string" name="Description"></SimpleField>
            <SimpleField type="string" name="Location">
                <displayName><![CDATA[<b>Location</b>]]></displayName>
            </SimpleField>
            <SimpleField type="string" name="ParcelID">
                <displayName><![CDATA[<b>ParcelID</b>]]></displayName>
            </SimpleField>
            <SimpleField type="string" name="Zone"></SimpleField>
            <SimpleField type="string" name="AssessArea"></SimpleField>
            <SimpleField type="string" name="Owner"></SimpleField>
            <SimpleField type="string" name="CoOwner"></SimpleField>
            <SimpleField type="string" name="Address1"></SimpleField>
            <SimpleField type="string" name="Address2"></SimpleField>
            <SimpleField type="string" name="City"></SimpleField>
            <SimpleField type="string" name="State"></SimpleField>
            <SimpleField type="string" name="ZIP"></SimpleField>
            <SimpleField type="string" name="AcctNum"></SimpleField>
            <SimpleField type="string" name="YearBuilt"></SimpleField>
            <SimpleField type="string" name="LandValue"></SimpleField>
            <SimpleField type="string" name="BldgValue"></SimpleField>
            <SimpleField type="string" name="OtherValue"></SimpleField>
            <SimpleField type="string" name="TotalValue"></SimpleField>
            <SimpleField type="string" name="MainBldgDesc"></SimpleField>
            <SimpleField type="string" name="StateCode"></SimpleField>
            <SimpleField type="string" name="SaleDate"></SimpleField>
            <SimpleField type="string" name="Rooms"></SimpleField>
            <SimpleField type="string" name="Beds"></SimpleField>
            <SimpleField type="string" name="Baths"></SimpleField>
        </Schema>
        <Folder>
            <name>ParcelJoinedFldr</name>
            <Placemark>
                <styleUrl>#outline</styleUrl>
                <ExtendedData>
                    <SchemaData schemaUrl="#ParcelJoinedID">
                        <SimpleData name="Location">68 WALCOTT AVE</SimpleData>
                        <SimpleData name="ParcelID">9-459</SimpleData>
                        <SimpleData name="Zone">R40$39</SimpleData>
                        <SimpleData name="AssessArea">3.72 AC</SimpleData>
                        <SimpleData name="Owner">CXXX, CXX R ET</SimpleData>
                        <SimpleData name="CoOwner">CXXX, GLXXA G</SimpleData>
                        <SimpleData name="Address1">32 EAST 88TH STREET</SimpleData>
                        <SimpleData name="Address2"></SimpleData>
                        <SimpleData name="City">NEW YORK</SimpleData>
                        <SimpleData name="State">NY</SimpleData>
                        <SimpleData name="ZIP">10021</SimpleData>
                        <SimpleData name="AcctNum">2421</SimpleData>
                        <SimpleData name="YearBuilt">1910</SimpleData>
                        <SimpleData name="LandValue">2036060</SimpleData>
                        <SimpleData name="BldgValue">479800</SimpleData>
                        <SimpleData name="OtherValue">1500</SimpleData>
                        <SimpleData name="TotalValue">2517360</SimpleData>
                        <SimpleData name="MainBldgDesc">CONVNTL</SimpleData>
                        <SimpleData name="StateCode">1100 - SEASONAL &amp; BEACH</SimpleData>
                        <SimpleData name="SaleDate">04/07/1995</SimpleData>
                        <SimpleData name="Rooms">0</SimpleData>
                        <SimpleData name="Beds">0</SimpleData>
                        <SimpleData name="Baths">4 Full / 0 H</SimpleData>
                    </SchemaData>
                </ExtendedData>
                <Polygon>
                    <outerBoundaryIs>
                        <LinearRing>
                            <coordinates>-71.363000752291924,41.489279023867283 -71.364928267362686,41.489246551445632 -71.364928271377551,41.48924655145035 -71.366127398895557,41.489226333780891 -71.366980322431843,41.489211945621989 -71.366980559667908,41.489218729506135 -71.366992415755973,41.489658359975031 -71.363335128398276,41.489691230204564 -71.36332242991972,41.489681182960041 -71.36320151947757,41.489583338563875 -71.363080572769988,41.489488329510586 -71.363012929798629,41.48940065703426 -71.363000855378388,41.489285011997865 -71.363000752291924,41.489279023867283</coordinates>
                        </LinearRing>
                    </outerBoundaryIs>
                </Polygon>
            </Placemark>
        </Folder>
    </Document>
</kml>

推荐答案

我认为,如果您使用简单的<ExtendedData><Data>元素(而不是<Schema>)来提供数据,则可能会起作用和<SchemaData>元素.

I think that it probably will work if you use simple <ExtendedData> and <Data> elements to provide the data, as well as or rather than <Schema> and <SchemaData> elements.

通过查看它,您是否甚至需要模式数据?您是否还在其他需要将数据作为类型化字符串的应用程序中使用KML?

From looking at it, do you even need schema data? Are you using the KML in some other application that requires the data as typed strings?

Google Earth和Google Maps会忽略类型数据,因此,如果您的kml没有其他用途,那么它只会使您的kml膨胀.

Google Earth and Google maps ignore the type data, so it is just bloating your kml if it doesn't have some other purpose for you.

您链接到的文档的前半部分对此进行了处理.

The first half of the document you linked to deals with this.

这篇关于BalloonStyle中的KML实体替换在GoogleMaps中失败,但在GoogleEarth中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆