|
发表于 2014-3-11 18:06:27
|
显示全部楼层
- <?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.123442,22.897634,60 114.123459,22.89776,61 114.123442,22.897634,60 114.123459,22.89776,61
- </coordinates>
- </LineString>
- </Placemark>
- </Document>
- </kml>
复制代码
上文是一个完整的KML文件, 只有这样的文件才能被Google Earth识别并在上面绘出路径.
以上文件99%的内容你都不必更改, 唯一需要更改的是 <coordinates>与</coordinates>之间的内容.
你只要将自己GPS得到的经纬度信息填入其中即可. 具体的格式为
经度,纬度,高度<空格>经度,纬度,高度<空格>.......
经纬度与高度之间以逗号间隔, 两组数据之间以空格隔开.
你需要怎么做?
1, 将从GPS报文中解码出来的经度纬度保存到SD卡上, 高度可选.
2, 将得到的经度纬度填到以上KML文件的<coordinates>与</coordinates>中间再保存为新文件, 后缀名为KML即可.
注意事项: 注意经度和纬度的单位都是度, 从GPS得到的数据需要转换一下.
我想你如果懂得C语言, 只要稍稍动手就可以将自己记录的格式转换为KML格式, 很简单的.
如果有不明白的地方请在下面继续提问. |
|