没有styleUrl的KML样式

时间:2017-08-09 08:15:46

标签: css xml kml google-earth

有没有办法着色,例如。没有使用styleUrl的地标吗? 我想要做的是直接在地标内设置地标样式,而不必声明样式ID并在地标中引用该ID。

我想象的是:

<Folder>
  <name>Paths</name>
  <Placemark>
    <name>Extruded</name>
    <visibility>1</visibility>
    <LineString color="7f00ffff" width="2">
      <extrude>1</extrude>
      <tessellate>0</tessellate>
      <altitudeMode>absolute</altitudeMode>
      <coordinates>
        -112.2656634181359,36.09445214722695,2630
        -112.2652238941097,36.09520916122063,2630
        -112.2645079986395,36.09580763864907,2830
        </coordinates>
    </LineString>
  </Placemark>
</Folder>

1 个答案:

答案 0 :(得分:1)

我自己想通了。您只需在地标内添加样式标记,但 对象中添加 。在提出问题之前我犯了错误,将样式标记放在线串中。

满足我需求的代码:

<Folder>
    <name>Paths</name>
    <Placemark>
        <Style>
            <LineStyle>
                <color>7f00ffff</color>
                <width>2</width>
            </LineStyle>
        </Style>
        <name>Extruded</name>
        <visibility>1</visibility>
        <LineString>
            <extrude>1</extrude>
            <tessellate>0</tessellate>
            <altitudeMode>absolute</altitudeMode>
            <coordinates>
                -112.2656634181359,36.09445214722695,2630
                -112.2652238941097,36.09520916122063,2630
                -112.2645079986395,36.09580763864907,2830
            </coordinates>
        </LineString>
    </Placemark>
</Folder>