gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
阅读:3231回复:10

[分享]编写你自己的gps应用程序

楼主#
更多 发布于:2004-09-17 15:56
<P>从codeguru转过来的,和大家一起学习下</P>
<P>Writing Your Own GPS Applications: Part I
</P>
<P><b>Environment:</b>  C#, VB.NET, Visual Studio 2002/2003/2005, .NET Framework, .NET Compact Framework </P>

<P><IMG src="http://www.codeguru.com/dbfiles/get_image.php?id=8079;lbl=GPSPOCKETPC3_JPG;ds=20040901"></P>
<P>"I am continually amazed by how little code is required to use atomic clocks in satellites 11,000 miles above my head."</P>
<P>What is it that GPS applications need to be good enough to handle in-car navigation? Also, how does the process of interpreting GPS data actually work? In this two-part series, I will cover both topics and give you the skills you need to write a commercial-grade GPS application that works with a majority of GPS devices in the industry today.</P>
<H3>One Powerful Sentence</H3>
<P>This first part in the series will explore the task of interpreting raw GPS data. Fortunately, the task is simplified thanks to the National Marine Electronics Association (www.nmea.org), which introduced a standard for the industry now in use by a vast majority of GPS devices. To give developers a head start, I chose to use some Visual Studio.NET source code from my "GPS.NET Global Positioning SDK" component. (The code is stripped of features like multithreading and error handling for brevity.)</P>
<P>NMEA data is sent as comma-delimited "sentences" that contain information based on the first word of the sentence. There are over fifty kinds of sentences, yet an interpreter really only needs to handle a few to get the job done. The most common NMEA sentence of all is the "Recommended Minimum" sentence, which begins with "$GPRMC." Here is an example:</P><PRE>$GPRMC,040302.663,A,3939.7,N,10506.6,W,0.27,358.86,200804,,*1A</PRE>
<P>This one sentence contains nearly everything a GPS application needs: latitude, longitude, speed, bearing, satellite-derived time, fix status, and magnetic variation.</P>
<H3>The Core of An Interpreter</H3>
<P>The first step in making an NMEA interpreter is writing a method that does two things: separating each sentence into its individual words and then examining the first word to figure out what information is available to extract. Listing 1-1 shows the start of the interpreter class.</P>
<P><B>Listing 1-1:</B> The core of an NMEA interpreter is a function which divides NMEA sentences into individual words.</P><PRE>'*******************************************************
'**  Listing 1-1.  The core of an NMEA interpreter
'*******************************************************
Public Class NmeaInterpreter
 ' Processes information from the GPS receiver
 Public Function Parse(ByVal sentence As String) As Boolean
  ' Divide the sentence into words
  Dim Words() As String = GetWords(sentence)
  ' Look at the first word to decide where to go next
  Select Case Words(0)
   Case "$GPRMC"    ' A "Recommended Minimum" sentence was found!
    ' Indicate that the sentence was recognized
    Return True
   Case Else
    ' Indicate that the sentence was not recognized
    Return False
  End Select
 End Function
 ' Divides a sentence into individual words
 Public Function GetWords(ByVal sentence As String) As String()
  Return sentence.Split(","c)
 End Function
End Class
</PRE>
<P><B>About the Author</B>
Jon Person is the author of the award-winning "<a href="http://www.gpsdotnet.com/" target="_blank" >GPS.NET Global Positioning SDK</A>" component and has consulted for military companies and the Forest Service on GPS solutions. Jon frequently writes about GPS application development and welcomes all questions and comments at <a href="mailtinfo@gpsdotnet.com" target="_blank" >info@gpsdotnet.com</A>. </P>
<P>第一部分的代码:</P>
<P><B>Downloads</B>

<LI><a href="http://www.codeguru.com/dbfiles/get_file/PartOneListings.zip?id=8079;lbl=PARTONELISTINGS_ZIP;ds=20040901" target="_blank" >PartOneListings.zip</A> - Listings for Part One (Visual Basic.NET)
</LI>
喜欢0 评分0
GIS麦田守望者,期待与您交流。
xiaoye
路人甲
路人甲
  • 注册日期2004-07-28
  • 发帖数81
  • QQ
  • 铜币218枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2004-10-16 22:07
<img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em02.gif" />
举报 回复(0) 喜欢(0)     评分
tell
路人甲
路人甲
  • 注册日期2003-11-20
  • 发帖数28
  • QQ
  • 铜币184枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2004-10-14 09:39
<img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em04.gif" />
举报 回复(0) 喜欢(0)     评分
edward22
路人甲
路人甲
  • 注册日期2004-07-01
  • 发帖数121
  • QQ
  • 铜币506枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2004-09-23 11:22
<img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em01.gif" />
如果你爱他就让他学GIS,如果你恨他就让他学GIS!
举报 回复(0) 喜欢(0)     评分
wjm8078
路人甲
路人甲
  • 注册日期2004-09-09
  • 发帖数58
  • QQ
  • 铜币101枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2004-09-21 15:25
<img src="images/post/smile/dvbbs/em05.gif" />kanbudong!
举报 回复(0) 喜欢(0)     评分
liguangan
路人甲
路人甲
  • 注册日期2004-09-20
  • 发帖数20
  • QQ49845327
  • 铜币142枚
  • 威望0点
  • 贡献值0点
  • 银元0个
5楼#
发布于:2004-09-21 09:27
<img src="images/post/smile/dvbbs/em02.gif" />
李广安
举报 回复(0) 喜欢(0)     评分
CyberTiger
路人甲
路人甲
  • 注册日期2004-08-17
  • 发帖数247
  • QQ
  • 铜币975枚
  • 威望0点
  • 贡献值0点
  • 银元0个
6楼#
发布于:2004-09-18 08:40
<img src="images/post/smile/dvbbs/em02.gif" />
只有交流,才能提高。

只有共享,才有快乐。

举报 回复(0) 喜欢(0)     评分
wangjh
论坛版主
论坛版主
  • 注册日期2003-08-22
  • 发帖数994
  • QQ55359982
  • 铜币2579枚
  • 威望0点
  • 贡献值0点
  • 银元0个
7楼#
发布于:2004-09-17 23:37
<P><img src="images/post/smile/dvbbs/em01.gif" /></P><img src="images/post/smile/dvbbs/em07.gif" />
网 站: www.52xoo.com (3S,信息融合,数字图像处理,模式识别与人工智能等专业电子书、学术文章及源代码共享) E-mail: Jianhong72@163.com QQ: 88128745 (55359982用了近10年,最近被盗了,郁闷!!!)
举报 回复(0) 喜欢(0)     评分
saqimi
路人甲
路人甲
  • 注册日期2004-01-06
  • 发帖数50
  • QQ
  • 铜币138枚
  • 威望0点
  • 贡献值0点
  • 银元0个
8楼#
发布于:2004-09-17 16:42
顶~
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15951
  • QQ
  • 铜币25345枚
  • 威望15368点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
9楼#
发布于:2004-09-17 15:58
<P>贴在这里不太好看,还是把地址贴出来,大家自己去看吧</P>
<P><a href="http://www.codeguru.com/vb/mobile/pocketpc/article.php/c8079__1/" target="_blank" >http://www.codeguru.com/vb/mobile/pocketpc/article.php/c8079__1/</A></P>
[此贴子已经被作者于2004-9-17 16:00:52编辑过]
GIS麦田守望者,期待与您交流。
举报 回复(0) 喜欢(0)     评分
上一页
游客

返回顶部