Поделиться через


FakeGPS and Editing NMEA .txt files

So I have been doing a lot of work with Virtual Earth and Windows Mobile, incorporating GPS as well.  FakeGPS is an excellent tool to help GPS development but with one challenge:  How do you change the reported locations?

The FakeGPS tool reads from text files located in the GPSFiles folder where FakeGPS is installed on the device.

image

The files are in NMEA file format, reporting locations in the Seattle area.  There are a bunch of links out there that talk about the file format but I found this page to be useful.

https://www.gpsinformation.org/dale/nmea.htm

It explains the format and provides some examples.  What I did is grabbed a few sample entries from the file to create this sample file. I primarily looked at the entry for GPRMC, GPGGA, and GPGGLL at the above link to change the date, time, and location values for the entry. 

$GPRMC,053729,A,3203.156,N,08104.482,W,000.0,360.0,131008,015.5,E*
$GPRMB,A,,,,,,,,,,,,V*
$GPGGA,053730,3203.356,N,08104.482,W,1,05,1.6,646.4,M,-24.1,M,,*
$GPGSA,A,3,02,,,07,,09,24,26,,,,,1.6,1.6,1.0*
$GPGSV,2,1,08,02,43,088,38,04,42,145,00,05,11,291,00,07,60,043,35*
$GPGSV,2,2,08,08,02,145,00,09,46,303,47,24,16,178,32,26,18,231,43*
$PGRME,22.0,M,52.9,M,51.0,M*
$GPGLL,3203.360,N,08104.481,W,053730,A*
$PGRMZ,2062,f,3*
$PGRMM,WGS 84*
$GPBOD,,T,,M,,*
$GPRTE,1,1,c,0*
$GPRMC,053731,A,3203.482,N,08104.436,W,000.0,360.0,131008,015.5,E*
$GPRMB,A,,,,,,,,,,,,V*

You can modify this to generate GPS data for your desired location.  the bold items are either a UTC time or a date.  To help you interpret the values, the value of 053729 is UTC time in HHMMSS format.  The value of 131008 is October 13th, 2008 in DDMMYY format. 

The latitude data is in red and the longitude data is in green in the above example.  As an example, 3203.156,N represents 32 degrees, 03.156 minutes N.  08104.482,W represents 081 degrees, 04.482 minutes West. 

You will normally see latitude and longitude represented as something like this 32.2432 N and 081.1234 W (west and south are negative values) so you will have to convert between the float value and the degrees / minutes value.

The last thing I wanted to mention is that there is normally a checksum on the lines that end in an asterisk (*) in the file above.  The checksum value represents all of the characters between the $ and * XOR'd.  I was lazy and tested the file by simply leaving the checksum value off and it worked fine with FakeGPS.  So if you have another file that you want to modify, be sure to delete the checksum value after the asterisk.

Comments