软件应用教程

Android模拟GPS数据生成kml和nmea文件 Android开发技术

Android模拟GPS数据生成kml和nmea文件 Android开发技术

在Android平台上开发可能没有真机的时候,我们通过DDMS中载入KML或NMEA文件来模拟生产数据,使用方法参考 新版ADT插件让Android开发更人性化 一文,最终这两个文件加载到/data/misc/location/gps/nmea或/data/misc/location/gps/kml/

一、KML文件其实是一个XML文件,我们看下KML文件结构

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.2">
<Document>
<name>1065 Brea Mall, Brea, CA 92821.kml</name>
<StyleMap id="default_copy0+nicon=http://maps.google.com/mapfiles/kml/pal3/icon60.png+hicon=http://maps.google.com/mapfiles/kml/pal3/icon52.png">
<Pair>
<key>normal</key>
<styleUrl>#default_copy0+icon=http://maps.google.com/mapfiles/kml/pal3/icon60.png</styleUrl>
</Pair>
<Pair>
<key>highlight</key>
<styleUrl>#default_copy0+icon=http://maps.google.com/mapfiles/kml/pal3/icon52.png</styleUrl>
</Pair>
</StyleMap>
<Style id="default_copy0+icon=http://maps.google.com/mapfiles/kml/pal3/icon52.png">
<IconStyle>
<scale>1.1</scale>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pal3/icon52.png</href>
</Icon>
</IconStyle>
<LabelStyle>
<scale>1.1</scale>
</LabelStyle>
</Style>
<Style id="default_copy0+icon=http://maps.google.com/mapfiles/kml/pal3/icon60.png">
<IconStyle>
<Icon>
<href>http://maps.google.com/mapfiles/kml/pal3/icon60.png</href>
</Icon>
</IconStyle>
</Style>
<Placemark>
<name>1065 Brea Mall, Brea, CA 92821</name>
<address>1065 Brea Mall, Brea, CA 92821</address>
<LookAt>
<longitude>-117.883593</longitude>
<latitude>33.916991</latitude>
<altitude>0</altitude>
<range>1000</range>
<tilt>0</tilt>
<heading>0</heading>
</LookAt>
<styleUrl>#default_copy0+nicon=http://maps.google.com/mapfiles/kml/pal3/icon60.png+hicon=http://maps.google.com/mapfiles/kml/pal3/icon52.png</styleUrl>
<Point>
<coordinates>-117.883593,33.916991,0</coordinates>
</Point>
</Placemark>
</Document>
</kml>

二、NMEA协议就是常规的GPS数据,通过串口直接获取到的,如下

$GPRMC,003347.000,A,3725.3433,N,12205.7920,W,0.08,149.46,061007,,,D*70
$GPRMC,003348.000,A,3725.3433,N,12205.7921,W,0.05,142.51,061007,,,D*7E
$GPRMC,003349.000,A,3725.3432,N,12205.7921,W,0.08,159.56,061007,,,D*7E
$GPRMC,003350.000,A,3725.3432,N,12205.7921,W,0.06,151.59,061007,,,D*7F
$GPRMC,003351.000,A,3725.3432,N,12205.7921,W,0.20,120.57,061007,,,D*72

  实例:

 

  解析方法:

 RMC = Recommended Minimum Specific GPS/TRANSIT Data

$GPRMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,ddmmyy,x.x,a*hh

1 = UTC(universal time, coordinated) of position fix
2 = Data status (A=good, V=navigation receiver warning)
3 = Current Latitude
4 = North/South in Latitude Hemisphere
5 = Current Longitude
6 = East/West in Longitude Hemisphere
7 = Speed over ground in knots
8 = (Direction of travel N:0°, E:90°, S:180°, W:270°)
9 = UT DateStamp
10 = Magnetic variation degrees (Easterly var. subtracts from true course)
11 = East/West
12 = Checksum

 

$GPRMC,003347.000,A,3725.3433,N,12205.7920,W,0.08,149.46,061007,,,D*70

Parts:
1:   003347.000  –>   0:33 am 47 seconds 0 milliseconds (UTC(universal time, coordinated) of position fix)
2:   A           –>   Status is ok   (Data status (A=good, V=navigation receiver warning))
3:   3725.3433         (North/South in Latitude Hemisphere)
4:   N           –>   North   (North/South)
5:   12205.7920        (Current Longitude)
6:   W           –>   West   (East/West in Longitude Hemisphere)
7:   0.08        –>   0.08 knots/second (Direction: North/West)   (Speed over ground in knots)
8:   149.46      –>   sth. like SouthEast (Direction of travel  N:0°, E:90°, S:180°, W:270°)
9:   061007      –>   6th October, 2007  (UT(universal time) DateStamp)
10:  <empty>           (Magnetic variation degrees (Easterly var. subtracts from true course))
11:  <empty>           (East/West)
12:  D*70              (Checksum)

软件应用教程

更多有关于 软件应用教程

如何利用火车采集软件采集58招聘信息_爬虫软件技术与爬虫软件网页数据采集器门户

什么是火车采集器 如何使用火车采集器软件_爬虫软件技术与爬虫软件网页数据采集器门户

如何使用火车采集器制作zencart数据包来进行批量导入商品_爬虫软件技术与爬虫软件网页数据采集器门户

火车头采集器的DedeCMS5.7文章免登陆发布接口_爬虫软件技术与爬虫软件网页数据采集器门户

火车头采集器如何把浏览器里面的cookie到火车头采集器里面_爬虫软件技术与爬虫软件网页数据采集器门户

火车头采集器教程之如何通过fiddler获取cookie简单教程_爬虫软件技术与爬虫软件网页数据采集器门户

火车头采集器FTP设置 图片下载上传的路径的设置_爬虫软件技术与爬虫软件网页数据采集器门户

火车头采集器文件图片下载路径设置简易说明_爬虫软件技术与爬虫软件网页数据采集器门户

火车采集器采集淘宝天猫商品采集多页获取宝贝详细教程_爬虫软件技术与爬虫软件网页数据采集器门户

本人擅长Ai、Fw、Fl、Br、Ae、Pr、Id、Ps等软件的安装与卸载,精通CSS、JavaScript、PHP、ASP、C、C++、C#、Java、Ruby、Perl、Lisp、Python、Objective-C、ActionScript、Pascal等单词的拼写,熟悉Windows、Linux、OS X、Android、iOS、WP8等系统的开关机。

通过下面的方式来联系我们:

电邮:138762189@qq.com

联系QQ:点击这里给我发消息

官方站:www.tadke.com

※ ※ 联系请加我的企鹅号 ※※

※ ※技术支持请微信联系站长 ※※

Copyright © 2016 Tadke.com. Powered by Wordpress.