下面为将机器人的轨迹对应到谷歌地球上的demo,只需要将 <coordinates> 与 </coordinates>之间的经纬度坐标换成自己的经纬度坐标数据,然后将下面的内容保存的到文件中,将扩展名改为.kml,再打开google earth,将该文件拖进去,即可在上面显示对应的坐标轨迹。(有个小问题,如果大家要把下面的内容copy然后尝试一下用google earth加载,记得copy到文件之后把后面的作者,来源,版权,声明的那个去掉(⊙o⊙))
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>X-GPS Explorer</name>
<Style id="X-GPSExplorer">
<IconStyle>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pushpin/ylw-pushpin.png</href>
</Icon>
<hotSpot x="32" y="1" xunits="pixels" yunits="pixels" />
</IconStyle>
</Style>
<Folder>
<name>Place Mark</name>
</Folder>
<Placemark>
<name>My Path</name>
<Style>
<LineStyle>
<color>ff0000ff</color>
<width>2</width>
</LineStyle>
</Style>
<LineString>
<coordinates>
114.3550997,30.53966355
114.3551003,30.53966349
114.3551008,30.53966342
114.3551014,30.53966335
114.3551019,30.53966328
114.3551025,30.53966317
114.3551031,30.53966305
114.3551037,30.53966294
114.3551043,30.53966283
114.3551049,30.53966272
114.3551055,30.5396626
114.3551061,30.53966249
114.3551067,30.53966237
114.3551073,30.53966225
114.3551079,30.53966215
114.3551085,30.53966202
114.3551091,30.53966189
114.3551096,30.53966176
114.3551102,30.53966165
114.3551107,30.53966154
114.3551113,30.53966145
114.3551119,30.53966137
114.3551124,30.53966129
114.355113,30.53966123
114.3551136,30.53966116
114.3551143,30.53966103
114.355115,30.53966089
114.3551157,30.53966076
114.3551164,30.53966063
114.355117,30.5396605
114.3551177,30.53966037
114.3551184,30.53966025
114.3551191,30