Download gps coordinate converter degrees to decimal

Gps coordinate converter degrees to decimal

Get via App Store Read this post in our app!

Convert Degrees/Minutes/Seconds to Decimal Coordinates

In one part of my code I convert from decimal coordinates to degrees/minutes/seconds and I use this:

How would I convert back from degrees/minutes/seconds to decimal coordinates?

Just to save others time, I wanted to add on to Byron's answer. If you have the point in string form (e.g. "17.21.18S"), you can use this method:

Since degrees are each worth 1 coordinate total, and minutes are worth 1/60 of a coordinate total, and seconds are worth 1/3600 of a coordinate total, you should be able to put them back together with:

Beware that it won't be the exact same as the original, though, due to floating-point rounding.

Often the western and southern hemispheres are expressed as negative degrees, and seconds contain decimals for accuracy: -86:44:52.892 Remember longitude is the X-coordinate and latitude is the Y-coordinate. This often gets mixed up because people often refer to them lat/lon and X/Y. I modified the code below for the above format.

The accepted answer to date is inaccurate and doesn't take into account what happens when you add negative numbers to positive numbers. The below code addresses the issue and will correctly convert.

Gps coordinate converter degrees to decimal

This will convert your degree notation into a decimal degree or vice versa.

When converting to decimal don't bother about ° sign or any other. Just separate the degrees from minutes and seconds with a space like this:

30 0 19, which will mean 30° 0' 19".

Examples of correct inputs for Degree:

Did you find us useful?

Please consider supporting the site with a small donation.