Author Topic: Plot your GPS data in Google Maps  (Read 7129 times)

0 Members and 1 Guest are viewing this topic.

Offline WebbotTopic starter

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Plot your GPS data in Google Maps
« on: April 07, 2010, 10:31:17 AM »
This was mentioned on another thread as being an interesting project. I haven't created a tutorial as its very easy!

http://www.gpsvisualizer.com/ does it all for you.

Make sure you read the help files about building plain text waypoint files, and track files, at http://www.gpsvisualizer.com/tutorials/

Here is a very simple example of a track file containing latitude, longitude, and altitude:-

type,latitude,longitude,alt
T,45.9874167,-76.8752333,79.8
T,45.9860000,-76.8737833,111.4
T,45.9850500,-76.8724833,107.9
T,45.9844000,-76.8716333,120.0
T,45.9839500,-76.8710000,117.5


The first line shows what the column contains and you can add and remove different sorts of data.
So just copy that example into a text file and upload it into 'GPSVisualizer' and there you have it!

One implementation would be to use WebbotLib to store the info in a file on an SD card.
On startup you would write the first line (the column headings).
In your main loop read the GPS and if the robot has moved by a 'significant' distance then write out a new line of data. Also check if the user has pressed a push button and, if so, close the file (to flush it all to disk) and stop your motors.

Then move the SD card to your PC and upload into GPSVisualizer





Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: Plot your GPS data in Google Maps
« Reply #1 on: April 07, 2010, 11:41:13 AM »
When I add an SD card to SAGAR for logging, I was thinking of just writing out a google earth kmz file directly to it. If i get it working, I'll post the code.

Offline WebbotTopic starter

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Plot your GPS data in Google Maps
« Reply #2 on: April 07, 2010, 12:07:37 PM »
The only issues I see with KML/KMZ are:

1. You need have Google Earth loaded on your PC - whereas GPSVisualizer/Google Maps requires NO downloads.

2. Being XML based its quite big - not that its an issue with SD cards

3. Being XML then you have a problem with the balancing closing tag. If the user turns off the power without you flushing the file then you cant write the closing tag => corrupt XML file. So for each point you would have to write the data + a closing tag an then move the file pointer back so that the previous closing tag got deleted. With the text format then its easier as you just always 'append' to the file.

4. KMZ looks like its a compressed/zipped version of KML - which will be a challenge!

I know its 'in the future' for you - but just thinking aloud (or: thinking allowed?)

Currently WebbotLib converts longitude/latitude to radians but most of these files need 'degrees'. So I may need to change the lib (or folks can do the conversion themselves).
I might also add a 'distance traveled' function that takes two GPS locations and calculates the distance traveled in feet/meters/yards (not decided yet!). This would be useful to minimize the logged data - ie only record a new point once you've traveled, say, 2 meters from the previous logged point.





Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline madsci1016

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,450
  • Helpful? 43
    • Personal Website
Re: Plot your GPS data in Google Maps
« Reply #3 on: April 07, 2010, 12:13:49 PM »
I convert the GPS back to degrees just when sending them to my control interface to plot position real time. It's relatively easy, I'd leave the lib the way it is, as most math done on GPS coordinates requires radians anyway.

Some good point on google earth files. But I think it would still be nice to be able to do no post processing, just insert card into computer and open file.

Long way off anyway.
« Last Edit: April 07, 2010, 12:16:29 PM by madsci1016 »

Offline WebbotTopic starter

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: Plot your GPS data in Google Maps
« Reply #4 on: April 07, 2010, 12:29:21 PM »
I convert the GPS back to degrees just when sending them to my control interface to plot position real time. It's relatively easy, I'd leave the lib the way it is, as most math done on GPS coordinates requires radians anyway.
Good to know I'm doing something right!
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

 


Get Your Ad Here

data_list