Create KML file with linestring and placemarks

爷,独闯天下 提交于 2019-12-11 10:29:09

问题


I am building a KML file using an app that I have built. Right now I have it nicely drawing a linestring on the map. But, now I want to add a few placemarks inside the same KML file. When trying to do this it will show either the line string or the place mark, but not both.

How can I do this inside a KML file?

What I currently use:

<?xml version="1.0" encoding="UTF-8"?>
<kml xsi:schemaLocation="http://earth.google.com/kml/2.1 http://earth.google.com/kml2.1.xsd" xmlns="http://earth.google.com/kml/2.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <Placemark>
    <name>My Name</name>
    <Style>
        <LineStyle>
            <color>FF0000FF</color>
            <width>3.0</width>
        </LineStyle>
    </Style>
    <LineString>
      <extrude>false</extrude>
      <tessellate>true</tessellate>
      <altitudeMode>clampToGround</altitudeMode>
      <coordinates>A Ton of coordinates go here</coordinates>
    </LineString>
  </Placemark>
</kml>

回答1:


I figured out what I have to place all of the placemarks into a <Folder> in order to have multiple placemarks show, then it worked.



来源:https://stackoverflow.com/questions/7628867/create-kml-file-with-linestring-and-placemarks

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!