Forum Index > How to Parse GPS Data

By: JK Posted on: Oct 25 2011 at 09:49:33 PM
Hello, I have a Garmin USB-to-Serial GPS with which I can see the incoming data perfectly with Comm64. However, I am having trouble parsing data out of the incoming stream. One of the many strings that are passed is (in part, and as an example):

$GPGGA,011300,4432.2134, ....

If I want to extract for example, the 011300 parameter, what would you suggest? I can see all the data in a textbox, but I get data from the buffer with partial data or cannot use something like MID to find the $GPGGA string. It's my first day with the component!

Thank you

By: Support Posted on: Oct 26 2011 at 08:52:47 AM
There's two parts to this. One is getting the data out of the receive buffer. The next is parsing the string. You're asking about parsing the string so maybe you've already got the string but I'll give you an example of how I'd possibly get It.

Things like gps sometimes just feed a non-stop stream of data. If you know that each individual string always begins with the $ symbol you could use the EOF property (change it so that it triggers on receipt of the $ character) and whenever you get the $ you know that you have the start of a string. Keep taking in data until you get the end of the string (or perhaps till you get the start of the next string)

Now you have your whole string of data.

Things like that are usually a simple string with each element of the data delimited by some special character. Your data appears to be separated by a comma.

Take a look at the VB split function. That takes a string and the delimiter and returns an array containing each section of your string in a separate element of the array.

In your case you'd find the value you want in the second element of the array.

I hope I've explained this clearly.

By: Guest Posted on: Oct 13 2018 at 06:55:01 AM
Hello. And Bye.


Reply - add comment to this topic
You may enter letters, numbers and standard punctuation only. HTML and other scripts/tags will be rejected
  Topic:- How to Parse GPS Data

Your Name


Forum scripts and databases - Copyright (c) 2009 - 2012