Read format S27 26.559 W48 29.218

15 views
Skip to first unread message

Sandro007

unread,
Nov 20, 2010, 9:10:30 PM11/20/10
to google-map...@googlegroups.com
Hi,

When I download data from my GPS it has the S27 26.559 W48 29.218 format for lat lng coordinates. When I put it in Google maps website, I get the location.

However when I try to use the format in my code it doesn't work:

  var name = markers[i].getAttribute("name");
          var type = markers[i].getAttribute("type");
           var point = new google.maps.LatLng(
              (markers[i].getAttribute("S27 26.559 W48 29.218")));

What am I doing wrong ?

Any suggestions? Appreciate any help.

Thanks

Sandro

Rossko

unread,
Nov 20, 2010, 10:16:04 PM11/20/10
to Google Maps JavaScript API v3
> var point = new google.maps.LatLng(
> (markers[i].getAttribute("S27 26.559 W48 29.218")));
>
> What am I doing wrong ?

google.maps.LatLng() needs to be given two numbers representing
decimal degrees e.g.
google.maps.LatLng( -27.856 , 56.553 )

You'll need to parse the string of degrees and decimal minutes that
you have, and convert to decimal degrees.
Some ideas
http://www.google.com/search?q=convert+degree+minutes+decimal

Sandro007

unread,
Nov 21, 2010, 7:53:19 AM11/21/10
to google-map...@googlegroups.com
Thank you Rossko. I will look into that.

John M Phillips

unread,
Nov 21, 2010, 7:56:22 AM11/21/10
to Google Maps JavaScript API v3
This is entirely correct, but I would go a little deeper. You do not
say what program you are using to down-load data from the GPS.
First, see if you can set the output format to decimale degrees.
Second, try gpsbabel, http://www.gpsbabel.org/

Gpsbabel has a large number of output formats. I mostly use it to
produce KML files directly.

John Phillips
Reply all
Reply to author
Forward
0 new messages