资源描述:
《gprmc数据解析--减小误差》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、$001GPRMC,031922.00,A,3037.94132,N,10403.90629,E,0.110,,160713,,,D*74$001GPRMC,031929.00,A,3037.94225,N,10403.90430,E,0.213,,160713,,,D*70$001GPRMC,031936.00,A,3037.94267,N,10403.90257,E,0.378,,160713,,,D*73$001GPRMC,031943.00,A,3037.94246,N,10403.90088,E,0.426,,160713,,,D
2、*7E从上面最后一条的信息中得到原始的经纬度数据:3037.94246,N,10403.90088,E经度:10403.90088纬度:3037.94246为提高精度,转化成度分秒的处理如下:经度:10403.90088直接读104°37′?″,秒需要乘60,即0.90088*60=54.0528取54;0.528*60=3.168取3所以最后得经度的度分秒格式为:104°37′54.03″纬度处理同上得:30°37′55.28″或者将其转化为度分格式:经度:10403.90088;直接读104;余数3.90088÷60=0.0650146
3、7则经度的度分格式为:104.06501467纬度的度分格式为:30.63237433在谷歌地图上得到的经纬度如下所示:标准纬度:30.630254标准经度:104.067172经纬度一度为111000m,所以差距多少直接乘即可。经度误差:0.002157*111000=239.4m纬度误差:0.00212*111000=235.3m关于偏移的校正方法:一、用百度地图定位后再用GPS定位,算出经纬度差值,然后用gps获取的经纬度加上差值即可二、网友提供的算法,需要连接百度地图http://bbs.csdn.net/topics/390395
4、727protectedvoidrunTest()throwsThrowable{try{BaiduLocationbl=newBaiduLocation();bl.gpsx=120;//经度bl.gpsy=30;//纬度GetBaiduLocation(bl);if(bl.ok){intbaidux=(int)(bl.baidux*1E6);intbaiduy=(int)(bl.baiduy*1E6);//转换成功,这个坐标是百度专用的}else{///转换失败}}catch(Exceptionex){}}classBaiduLocati
5、on{publicfloatgpsx,gpsy;publicfloatbaidux,baiduy;publicbooleanok=false;}publicstaticStringGetBaiduLocation(floatx,floaty)throwsMalformedURLException,IOException{Stringurl=String.format("http://api.map.baidu.com/ag/coord/convert?from=0&to=4&x=%f&y=%f",x,y);HttpURLConnection
6、urlConnection=(HttpURLConnection)(newURL(url).openConnection());urlConnection.connect();BufferedReaderreader=newBufferedReader(newInputStreamReader(urlConnection.getInputStream()));Stringlines=reader.readLine();reader.close();urlConnection.disconnect();returnlines;}publics
7、taticbooleanGetBaiduLocation(BaiduLocationbl){try{bl.ok=false;Stringres=GetBaiduLocation(bl.gpsx,bl.gpsy);if(res.startsWith("{")&&res.endsWith("}")){res=res.substring(1,res.length()-2).replace(""","");String[]lines=res.split(",");for(Stringline:lines){String[]items=line.s
8、plit(":");if(items.length==2){if("error".equals(items[0])){bl.ok="0".equals(items[1]);}if