KML - 隐藏标签中的名称

时间:2014-09-03 14:29:31

标签: xml kml

我已经非常努力地给地标一个名字但没有在地图上显示在地标旁边。当您在Google地图中转到左侧时,列表中的所有地标都会显示[no name]。那么,有没有办法摆脱名称(如果我想命名地标并在左边有那个显示文件夹)?

我的KML结构如下所示:

<?xml version=\"1.0\" encoding=\"utf-8\" ?>
<kml xmlns=\"http://earth.google.com/kml/2.2\">
<Document>
<name>foo</name>
<Folder>
    <name>bar</name>
    <description>foo bar</description>
    <Placemark>
        <Style>
            <LineStyle>
                <color>ffff0000</color>
                <width>2</width>
            </LineStyle>
        </Style>
        <name></name>
        <LineString>
            <coordinates>{},{},{},{},{},{}</coordinates>
        </LineString>
    </Placemark>
    <Placemark>
        <Style>
            <IconStyle>
                <Icon><href>file://{11}arrow.png </href></Icon>
                <heading>{4}</heading>
                <color>{10}</color>
                <scale>.6</scale>
            </IconStyle>
        </Style>
        <name></name>
        <scale>0</scale>
        <color>{10}</color>
        <description>{9}<br/><b>duration:</b> {8}<br/><b>time:</b> {7}<br/><b>CNR:</b> {5}<br/><b>BER:</b> {6}</description>
        <Point><coordinates>{0},{1},{2}</coordinates></Point>
    </Placemark>

    <Placemark>
        <Style>
            <LineStyle>
                <color>ffff0000</color>
                <width>2</width>
            </LineStyle>
        </Style>
        <name></name>
        <LineString>
            <coordinates>{},{},{},{},{},{}</coordinates>
        </LineString>
    </Placemark>
    <Placemark>
        <Style>
            <IconStyle>
                <Icon><href>file://{11}arrow.png </href></Icon>
                <heading>{4}</heading>
                <color>{10}</color>
                <scale>.6</scale>
            </IconStyle>
        </Style>
        <name></name>
        <scale>0</scale>
        <color>{10}</color>
        <description>{9}<br/><b>duration:</b> {8}<br/><b>time:</b> {7}<br/><b>CNR:</b> {5}<br/><b>BER:</b> {6}</description>
        <Point><coordinates>{0},{1},{2}</coordinates></Point>
    </Placemark>
    ...repeat <Placemark><LineString></LineString></Placemark><Placemark></Placemark>...
</Folder></Document>
</kml>

您可以看到样式块后面的名称为空,因为我真的不希望它显示在地标旁边。 (快速注意:括号来自写入文件的python脚本,因此只需忽略括号。)

如果我在<name</name>内放置了一些内容(在LineString内部的“普通”地标内),我怎么能让它不显示在地标旁边?

1 个答案:

答案 0 :(得分:4)

使用<LabelStyle>元素将标签的<scale>属性设置为0。这样您就可以在侧面板中显示Placemark的名称,但地图上没有显示标签。

相关问题