KML中的路径遵循赤道而不是坐标

时间:2016-11-08 15:12:26

标签: kml google-earth

我想在Google地球中显示一条路径。

下面的KML产生一条沿赤道的路径,在28度45分E和81度52分W之间。

我没有看到KML可能是一个明显的问题。有人可以告诉我这个问题吗?

<?xml version="1.0" encoding="utf-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
   <Document>
      <name>Paths</name>
      <Style id="transPurpleLineGreenPoly">
         <LineStyle>
            <color>7f00ff00</color>
            <width>4</width>
         </LineStyle>
         <PolyStyle>
            <color>7f00ff00</color>
         </PolyStyle>
      </Style>
      <Placemark>
         <visibility>1</visibility>
         <description>Path from Chile to Florida</description>
         <styleUrl>#transPurpleLineGreenPoly</styleUrl>
         <LineString>
            <tessellate>1</tessellate>
            <altitudeMode>clampToGround</altitudeMode>
            <coordinates>
              -70.900,  -27.117, 0
              -72.800,  -29.600, 0
              -80.000,  -20.000, 0
              -80.000,  -10.000, 0
              -80.200,  -7.300,  0
              -81.900,  -5.250,  0
              -81.250,  -3.000,  0
              -81.800,  -0.900,  0
              -80.000,  7.000, 0
              -79.453,  8.781, 0
              -79.521,  8.888, 0
              -79.559,  8.938, 0
              -79.569,  8.950, 0
              -79.585,  8.990, 0
              -79.591,  8.996, 0
              -79.599,  9.004, 0
              -79.604,  9.010, 0
              -79.619,  9.023, 0
              -79.643,  9.038, 0
              -79.656,  9.056, 0
              -79.672,  9.069, 0
              -79.691,  9.107, 0
              -79.703,  9.115, 0
              -79.717,  9.118, 0
              -79.750,  9.121, 0
              -79.768,  9.112, 0
              -79.806,  9.120, 0
              -79.815,  9.161, 0
              -79.844,  9.182, 0
              -79.850,  9.183, 0
              -79.862,  9.181, 0
              -79.874,  9.182, 0
              -79.924,  9.211, 0
              -79.924,  9.256, 0
              -79.924,  9.267, 0
              -79.921,  9.285, 0
              -79.919,  9.302, 0
              -79.919,  9.327, 0
              -79.919,  9.349, 0
              -79.919,  9.366, 0
              -79.919,  9.379, 0
              -79.919,  9.390, 0
              -80.008,  9.474, 0
              -75.000,  18.500, 0
              -73.673,  20.340, 0
              -75.516,  21.986, 0
              -76.767,  23.657, 0
              -77.500,  24.900, 0
              -79.341,  26.743, 0
              -79.889,  26.794, 0
              -79.987,  27.193, 0
              -80.058,  27.476, 0
              -80.128,  27.604, 0
              -80.269,  27.939, 0
              -80.452,  28.414, 0
              -80.508,  28.659, 0
              -80.589,  28.744, 0
            </coordinates>
         </LineString>
      </Placemark>
   </Document>
</kml>

1 个答案:

答案 0 :(得分:1)

这是一个常见的错误。 KML在 {经度,纬度,高度} 元组中不能有空格,否则会导致每个值被解释为缺少纬度和高度值的经度。 KML规范的定义很严格,空格用于分隔每个元组。 KML Reference状态“不包含元组内的空格”。

KML的描述如下:

    <coordinates>
      -70.900,  -27.117, 0
      -72.800,  -29.600, 0
      ...
    </coordinates>

空白实际上描绘了坐标元组,因此“-70.900”变为一个元组,其中经度为-70,纬度为0,高度为0.所有点将被指定为纬度0并在赤道上显示为一条线。这条“线”被解释为:

    <coordinates>
     -70.900,0,0
     -27.117,0,0
     0,0,0
     -72.8,0,0
     -29.6,0,0
     0,0,0
     ...
    </coordinates>

KML Errata

中详细介绍了此问题

要修复,需要删除每组坐标内的空格:

    <coordinates>
      -70.900,-27.117,0
      -72.800,-29.600,0
      ...
    </coordinates>