I wrote myself a wee utility page to help me do latitude and longitude arithmetic and generate 'geo-tagging' tags (meta tags that locate your web site or page in the physical world). I thought I'd share it in case it's of use to anyone else...
To use it, enter the data you wish to convert and click the 'show all forms' button. Each field accepts a whole or decimal number with or without a minus sign, plus there's a place to select the 'hemisphere' if you wish. Some fields override others (e.g. a negative degree number is overridden by a hemisphere selection of "N"), but validation is non-existent, so I'm sure you can make it produce junk if you try hard enough. ;-) (N.B.: tested with Firefox only.)
I recieved an enquiry about this page, so I thought I'd post it, and my reply, in case it is of further help to anyone else...
First of all, I would like to congratulate you for your site on GPS "hints" that helped me quite a lot in starting up with my own GPS application on my Pocket PC. The tutorials and links on your page were very helpful.
I was just wondering if you could give me some light on the subject of "geo-tagging" and the "converter" that you have on your web site. I've noticed that if I use the coordinates that my GPS receiver provides, for example, in a program like Google Earth, it points out to a completely different place from where I've been with the GPS receiver. However, if I use your "converter" to "show all forms" of the coordinates and if I use these new ones in Google Earth it points out to the right place where I was. I tried having a look at your page source code and I found these very interesting formulas:
vLatSec = Math.abs(vLatDeg * 3600.0) + Math.abs(vLatMin * 60.0) + Math.abs(vLatSec);
vLatDeg = Math.floor(vLatSec / 3600.0);
sLatDeg = "" + vLatDeg;
var vSec = vLatSec - (vLatDeg * 3600);
sLatMin1 = Number(vSec / 60.0).toFixed(4);
vLatMin = Math.floor(vSec / 60.0);
There's more to this, but in fact what I wanted to know was the "science" behind all this :-) Why is this type of conversion needed? What does this mean in fact, to multiply the Latitude degrees by 3600 and all the other formulas? Where can I find more information on this "algorithm"?
Thanks very much for any help that you can provide me.
Special regards from this fellow Portuguese GPS entusiast :-)
There are two main ways to represent longitude/latitude values: "metric/decimal", i.e. degrees(°) only; and "imperial", i.e. degrees(°), minutes(') and seconds("). You can also get combinations of the two (e.g. "imperial" degrees plus "metric/decimal" minutes). You will also see the use of "N"/"S"/"E"/"W" to indicate which "hemisphere" you're talking about, or you will see a minus sign used to indicate "S"/"W".
My "converter" provides an quick-and-dirty way to switch between the 5 formats I use most. My "converter" is a bit crude (I'm not even sure it works in Internet Explorer), but it works well enough. My "converter" uses some simple maths to do its work: 1° = 60' = 3600".The 5 formats my "converter" spits out are:
- metric/decimal, negative values are South/West, e.g. -45.6789°, 0.0000°
- metric/decimal, negative values not allowed, N/S/E/W indicator, e.g. 45.6789° S, 0.0000° E
- imperial degrees plus metric/decimal minutes, e.g. 45° 40.7340' S, 0° 0.0000' E
- all imperial, e.g. 45° 40' 44" S, 0° 0' 0" E
- imperial degrees and minutes, plus metric/decimal seconds, e.g. 45° 40' 44.04" S, 0° 0' 0.00" E
Google Earth uses the topmost format (i.e. "metric/decimal, negative values are South/West"). My guess is that your GPS is outputting coordinates in one of the other formats (probably the second format - which would put coordinates in Portugal somewhere in the middle of the Mediterranean Sea near Sardinia). You may want to see if your GPS software will allow you to save in the topmost format. I use OziExplorer to manipulate the data from my GPS and it allows me to save the output in any of the formats above.
¤ Copyright 1999-2018 Chris Molloy ¤ All rights reserved ¤