I have a database full of coordinates but they’re in the GPS format like this…
S25 48.518 E152 35.882
I need these coordinates converted to latitude and longitude values, but I can’t find any formula or function to do so. There’s hardly any information about this format available.
Has anyone had any experience with this GPS format?
I thought I might be able to help until I noticed that you are using the Degree-minutes method. I have a script to convert between decimals and degree-minutes-seconds. But that won’t suit your needs.
Try looking at this:
Near the bottom you can get a little idea of what you need to do.
Also, you never indicated which format you are trying to covert to. Degree-minutes-seconds (N35° 12’ 3.854’') or decimal (35.1245758). That’s important information.
Also see this:
WARNING: That script has a critical error. If you are converting from degrees-minutes-seconds to decimal (DMStoDEC), you must either strip the sign and append it back later (or determine sign using the directional indicator N, W, S, E) or subtract fractional decimals from the whole number for negative values or add for positive values or you will get an incorrect result!
The script has this line:
You must either append a negative sign to the return value if a negative value was passed in (after first stripping it off) or do something like this:
$fractional_part = (($min * 60) + $sec) / 3600;
if ($deg < 0)
$dec = $deg - $fractional_part;
elseif ($deg > 0)
$dec = $deg + $fractional_part;