如何取消选中KML文件中的文件夹 [英] How to uncheck folders in KML file
问题描述
我已将visibility
设置为0,但一点都没有运气,当我用Google Earth加载时仍会加载所有数据.如何取消选中所有文件夹和内部项目,以便用户可以选择以后需要的内容.我正在创建KML通过C#并且我发布了大KML文件的一小部分,我正在将其转换为KMZ
.以下kml
代码段
i have made visibility
to 0 but no luck at all,still loading all data when i load with Google Earth .How to uncheck all folders and inside items so user can select which ever required in later.i am creating KML through c# and i am posting small part of big KML file which i am converting in to KMZ
.What is wrong in following kml
snippet
<?xml version="1.0" encoding="utf-8"?>
<kml: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:json="http://www.w3.org/2005/Json">
<kml:Folder>
<kml:visibility>0</kml:visibility>
<kml:name>Test</kml:name>
<kml:open>1</kml:open>
<kml:Folder>
<kml:visibility>0</kml:visibility>
<kml:name>2G</kml:name>
<kml:open>1</kml:open>
<kml:Folder>
<kml:visibility>0</kml:visibility>
<kml:name>Icro</kml:name>
<kml:Folder>
<kml:visibility>0</kml:visibility>
<kml:name>Working</kml:name>
</kml:Folder>
</kml:Folder>
</kml:Folder>
</kml:Folder>
<kml:Folder>
<kml:visibility>0</kml:visibility>
<kml:name>3G</kml:name>
<kml:open>1</kml:open>
<kml:Folder>
<kml:visibility>0</kml:visibility>
<kml:name>Testro</kml:name>
<kml:Folder>
<kml:visibility>0</kml:visibility>
<kml:name>Working</kml:name>
<Document xmlns="http://www.opengis.net/kml/2.2">
<name>POINTS</name>
</Document>
</kml:Folder>
</kml:Folder>
</kml:Folder>
</kml:kml>
推荐答案
Google Earth中有一个功能",与KML 2.2规范描述数据的方式与父文件夹的可见性相矛盾.
There is a "feature" in Google Earth that contradicts how the KML 2.2 spec describes data is visible by the visibility of parent folders.
OGC KML 2.2标准声明为了使某个功能可见,其所有祖先的 kml:visibility 标签也应设置为1或true".这意味着在父文件夹上的可见性为0时应使该文件夹中包含的所有子地标都不可见.
The OGC KML 2.2 Standard states "in order for a Feature to be visible, the kml:visibility tag of all its ancestors shall also be set to 1 or true". This means that having visibility=0 on a parent folder should make all child placemarks contained within the folder not visible.
但是,Google Earth实现了可见性,即使未明确定义可见性(默认可见性= 1),子元素上的可见性也会覆盖父文件夹上的可见性,并且这违反了上述标准.据报道,这是2009年的 bug ,并描述了此处. Google对这个问题的回应如下:
However, Google Earth implements visibility such that visibility on a child element overrides visibility on parent folders even if the visibility is not explicitly defined (by default visibility=1) and this violates the standard as stated above. This was reported as a bug in 2009 and described here. Google responded to the issue as follows:
可见性始终在子元素级别被覆盖,并且 更改它会破坏现有代码"
"Visibility has always been overridden on the child element level, and changing this would break existing code"
这意味着所有不希望在启动时显示的KML地标必须明确具有可见性0,而不仅仅是在文件夹/文档"级别设置一次可见性.
这篇关于如何取消选中KML文件中的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!