0

我正在尝试创建一条基于 lon 和 lat 的路线。这是我到目前为止所拥有的,但它似乎无法正常工作。

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2"> 
<Document>
  <PlaceMark>
    <name>test</name>
    <description>test Desc</description>
    <Point>
      <coordinates>-80.54400115,43.4250264</coordinates>
      <coordinates>-80.52674314,43.43127701</coordinates>
      ...
    </Point>
    </PlaceMark>
  </Document>
<kml> 

语法是否正确?当我在我的地图应用程序中加载它时,它不显示路线。

4

1 回答 1

3

请参阅KML 参考

  1. KML 是区分大小写的 XML(PlaceMark 与 Placemark 不同)
  2. a<Point>是单个位置
  3. 一条线是一条<LineString>
  4. 您的 XML 必须有效(</kml>需要关闭开头<kml>)。

例子

谷歌地图上上述示例中的 KML

<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://www.opengis.net/kml/2.2">         <Document>
<Placemark><name>test</name>
<description>test Desc</description>
<LineString>
<coordinates>
-80.54400115,43.4250264
-80.52674314,43.43127701
-80.5274517,43.43458707
-80.53223781,43.43876923
-80.54385782,43.44993036
-80.53949137,43.45723788
-80.53950793,43.46780893
-80.53352615,43.4730443
-80.53491389,43.47816267
-80.54136061,43.48417145
-80.54163034,43.48439869
</coordinates>
</LineString>
</Placemark></Document>
</kml> 
于 2013-05-14T22:04:04.343 回答