如何获得纬度和经度的桌面应用程序? [英] How do I get latitude and longtitude for desktop application?

查看:135
本文介绍了如何获得纬度和经度的桌面应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我能获得纬度和经度上的Windows 7桌面应用程序?

Can I get latitude and longtitude on windows 7 desktop application?

通常它将在手机或平板电脑使用GPS,3G或WiFi。

Usually it will work on mobile or tablet using GPS, 3G or WiFi.

不过,我是怎么使用C#的坐标?

But how I get the coordinate using c#?

推荐答案

一个标准的GPS设备(内部或外部)发送一个串行端口上的数据。从串行端口接收到任何数据是很容易的。请检查此链接

A standard GPS device (internal or external) sends data on a serial port. Receiving any data from Serial Port is very easy. Please check this link.

    //define serial port
    SerialPort serialPort1 = new SerialPort();

    //configuring the serial port
    serialPort1.PortName="COM1";
    serialPort1.BaudRate=9600;
    serialPort1.DataBits=8;
    serialPort1.Parity=Parity.None;
    serialPort1.StopBits= StopBits.One;

   //read data from serial port
   string data = serialPort1.ReadExisting();

GPS数据是由对 NMEA 协议。数据本身就是ASCII文本,并且可以扩展到多个句子,如:

GPS data is composed on NMEA protocol. The data itself is just ascii text and may extend over multiple sentences e.g.

  • GGA
  • GSA
  • GSV
  • RMC

维基下面的示例数据。

$GPGGA,092750.000,5321.6802,N,00630.3372,W,1,8,1.03,61.7,M,55.2,M,,*76
$GPGSA,A,3,10,07,05,02,29,04,08,13,,,,,1.72,1.03,1.38*0A
$GPGSV,3,1,11,10,63,137,17,07,61,098,15,05,59,290,20,08,54,157,30*70
$GPGSV,3,2,11,02,39,223,19,13,28,070,17,26,23,252,,04,14,186,14*79
$GPGSV,3,3,11,29,09,301,24,16,09,020,,36,,,*76
$GPRMC,092750.000,A,5321.6802,N,00630.3372,W,0.02,31.66,280511,,,A*43

您可以使用位置数据(纬度/经度)是RMC的适当的字符串

The appropriate string you can use for location data (Latitude/Longitude) is RMC.

$GPRMC,092750.000,A,5321.6802,N,00630.3372,W,0.02,31.66,280511,,,A*43

这是信息描述这里

$GPRMC,225446,A,4916.45,N,12311.12,W,000.5,054.7,191194,020.3,E*68


       225446       Time of fix 22:54:46 UTC
       A            Navigation receiver warning A = OK, V = warning
       4916.45,N    Latitude 49 deg. 16.45 min North
       12311.12,W   Longitude 123 deg. 11.12 min West
       000.5        Speed over ground, Knots
       054.7        Course Made Good, True
       191194       Date of fix  19 November 1994
       020.3,E      Magnetic variation 20.3 deg East
       *68          mandatory checksum

有关完整的GPS数据分析就可以的检查此链接。希望这会有所帮助。

For complete GPS data parsing you can check this link. Hopefully it will help.

这篇关于如何获得纬度和经度的桌面应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆