SparkFun Forums 

Where electronics enthusiasts find answers.

Tips and questions relating to the GPS modules from SFE
By NleahciM
#11739
Hi - I'd like to take GPS data from an EM-406 and plot it in real time on Google Maps. Does anybody have any experience with anything like this? Thanks!
By Caffeine
#12368
NleahciM wrote:Hi - I'd like to take GPS data from an EM-406 and plot it in real time on Google Maps. Does anybody have any experience with anything like this? Thanks!
Not too sure about google maps, but it's possible with google earth with network links.

I wrote a small app that updates a kml file with the location, and another kml is a network link that refreshes the location every second.

For example, this is the KML (called Me.kml) that gets updated when the GPS data comes in:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Placemark>
  <name>Me</name>
  <LookAt>
    <longitude>151.100000</longitude>
    <latitude>-33.900000</latitude>
    <range>48</range>
    <tilt>0</tilt><heading>0</heading>
  </LookAt>
  <styleUrl>root://styleMaps#default+nicon=0x307+hicon=0x317</styleUrl>
  <Point>
    <altitudeMode>absolute</altitudeMode>
    <coordinates>151.100000,-33.900000,45</coordinates>
  </Point>
</Placemark>
</kml>
And this is the KML that loads the above data every second:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.google.com/earth/kml/2">
<NetworkLink>
  <name>Dynamic GPS Link</name>
    <description>Dynamically updates your GPS position</description>
  <visibility>1</visibility>
  <flyToView>1</flyToView>
  <url>
    <href>Me.kml</href>
    <refreshMode>onInterval</refreshMode>
    <refreshInterval>1</refreshInterval>
  </url>
</NetworkLink>
</kml>
By NleahciM
#12478
Caffeine wrote:
NleahciM wrote:Hi - I'd like to take GPS data from an EM-406 and plot it in real time on Google Maps. Does anybody have any experience with anything like this? Thanks!
Not too sure about google maps, but it's possible with google earth with network links.

I wrote a small app that updates a kml file with the location, and another kml is a network link that refreshes the location every second.

For example, this is the KML (called Me.kml) that gets updated when the GPS data comes in:
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://earth.google.com/kml/2.0">
<Placemark>
  <name>Me</name>
  <LookAt>
    <longitude>151.100000</longitude>
    <latitude>-33.900000</latitude>
    <range>48</range>
    <tilt>0</tilt><heading>0</heading>
  </LookAt>
  <styleUrl>root://styleMaps#default+nicon=0x307+hicon=0x317</styleUrl>
  <Point>
    <altitudeMode>absolute</altitudeMode>
    <coordinates>151.100000,-33.900000,45</coordinates>
  </Point>
</Placemark>
</kml>
And this is the KML that loads the above data every second:

Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.google.com/earth/kml/2">
<NetworkLink>
  <name>Dynamic GPS Link</name>
    <description>Dynamically updates your GPS position</description>
  <visibility>1</visibility>
  <flyToView>1</flyToView>
  <url>
    <href>Me.kml</href>
    <refreshMode>onInterval</refreshMode>
    <refreshInterval>1</refreshInterval>
  </url>
</NetworkLink>
</kml>
So that's just centering the map on those coordinates, correct? I found a phyton script called mehere (http://mehere.glenmurphy.com/) that does this, though it can only take 4800 baud input, and I'd really like it to take 9600 baud. The source code is posted, but I can't figure out how to compile it due to some wierd dependencies for the com port stuff.

But what I really want to do is actually plot out the course, so like plot a point every second or so, something like that. Even draw lines connecting points if possible.

Is that possible?
By Caffeine
#12504
Yes that's quite simple, the GE KML format includes lines, so you can just add a point to the line for each coordinate, and end up with something like this:

Image
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?> 
- <kml xmlns="http://earth.google.com/kml/2.0">
- <Placemark>
  <description>Driving from Home to Work</description> 
  <name>Home To Work</name> 
- <LookAt>
  <longitude>151.132628</longitude> 
  <latitude>-33.909663</latitude> 
  <range>4451.842204068102</range> 
  <tilt>44.61038665812578</tilt> 
  <heading>-125.7518698668815</heading> 
  </LookAt>
  <visibility>1</visibility> 
  <open>0</open> 
- <Style>
- <LineStyle>
  <color>7f00ff00</color> 
  <width>5</width> 
  </LineStyle>
- <PolyStyle>
  <color>7f00ff00</color> 
  </PolyStyle>
  </Style>
- <LineString>
  <tessellate>1</tessellate> 
  <altitudeMode>clampedToGround</altitudeMode> 
  <coordinates>151.181918, -33.919597, 98 151.181918, -33.919597, 98 151.182468, -33.919473, 69</coordinates> 
  </LineString>
  </Placemark>
  </kml>