1

I am using THIS article and example for testing my gps. And first of all I must say that program is really great, but of course I need some help.

FIRST

So what I need is to get coordinates in a "normal" (normal for my knowledge) European format for example in decimal as 16,445554477 something... Here I get degrees which is nice but I need it in decimal values. And when I tried put decimal values that I got in this program I don't know how to use them as I am not familiar with this format. For example I got 5600,35568 something... I don't know how to represent it in google maps.

SECOND

I am recording data from gps into database. Problem is that I get 2-4 records in one second. How to make it to one data per second? I have tried to look in the code but no success.

THIRD - and the last

Is how to implement this data from first question into Google maps API v3?

First question is the main one. Other two are only if someone knows what to do.

I am sure that lot of people are having same issues as I am. And of course there is many people that solved this "problems". So give me some examples please.

Have a nice coding :)

Cheers!

user123_456
  • 5,635
  • 26
  • 84
  • 140
  • You have 3 questions in this 1 question. Please narrow this down to one question (you can ask other questions in other questions). – user7116 May 10 '12 at 18:24
  • they are like small sub-questions, first one is main one and other two if someone knows something – user123_456 May 10 '12 at 18:26
  • [That's not how StackOverflow works](http://meta.stackexchange.com/questions/39223/one-post-with-multiple-questions-or-multiple-posts). – user7116 May 10 '12 at 18:30

2 Answers2

2

First
You need to parse your NMEA string, and the string you should be interested in is RMC

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

This has the information for Latitude and Longitude. To convert them from degree to x y coordinate check this thread. Once you convert them to X Y coordinate using WGS84, you would be able to use them in Google maps.
Second
Usually GPS data receiving interval is 1 (one) second. I am not sure how are you getting 2-4 records in a second. But I would suggest you to use a timer and fetch record after each second and only store the one you need, like in your case you need to store location based data which is available in GPRMC string. Please check this link Writing Your Own GPS Applications: Part 2
Third
If you want to display position based on the first question in the google maps, you will find lots of help on Google Maps API. I haven't work with this API, but I have worked with android.

Community
  • 1
  • 1
Habib
  • 219,104
  • 29
  • 407
  • 436
  • this is great answer I must say. Have you seen the program that I've linked? If you have in the source he is making some changes from degrees to some values but not the one that I need. So I can use degrees and transform them to the X Y coordinate system? Can you see the example? Maybe I have missed some code that is doing similar thing. maybe I can do some minor changes. – user123_456 May 10 '12 at 18:39
  • The one in the first sentence, click on the word THIS – user123_456 May 10 '12 at 18:43
  • @denonth, the only problem with that is, it is using British Ordnance Survey Grid, you should look for conversion to WGS84 which is standard – Habib May 10 '12 at 18:46
2

Some code I found at toptechboy.com

 degWhole=float(int(GPS.longitude/100)); //gives me the whole degree part of Longitude

 degDec = (GPS.longitude - degWhole*100)/60; //give me fractional part of longitude

 deg = degWhole + degDec; //Gives complete correct decimal form of Longitude degrees

  if (GPS.lon=='W') {  //If you are in Western Hemisphere, longitude degrees should be negative
    deg= (-1)*deg;
  }

Hope it helps...

Filip Ekberg
  • 36,033
  • 20
  • 126
  • 183
Art
  • 21
  • 1