没有 styleUrl 的 KML 样式

KML styling without styleUrl

有没有办法给例如着色。不使用 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>

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

满足我需求的代码:

<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>