Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to convert between degrees, minutes, seconds to Decimal coordinates

Looking for a java utility. It is even better if you can tell me how to do it using geotools library.

like image 918
Aravind Yarram Avatar asked Nov 25 '11 01:11

Aravind Yarram


People also ask

How do you convert latitude to decimal?

You can convert a latitudinal measurement from degrees to a decimal by following a mathematical formula. Divide minutes by 60. For example, if you had a degree followed by 45 minutes, you would divide 45 by 60 to get 0.75. Divide seconds by 3600.

How do you convert angle measures to decimal degrees?

Add up the integer number of degrees and minute/second fractions to convert the angle magnitude into the decimal form. In this example, the angle of 27 degrees, 12 minutes and 45 seconds corresponds to 27 + 0.2 + 0.0125 = 27.2125 degrees.


1 Answers

By "Decimal coordinates" do you mean latitude and longitude (also known as the decimal degree)? If so, what you're trying to do is pretty easy:

Given a DMS (Degrees, Minutes, Seconds) coordinate such as W87°43′41″, it's trivial to convert it to a number of decimal degrees using the following method: Calculate the total number of seconds, 43′41″ = (43*60 + 41) = 2621 seconds. The fractional part is total number of seconds divided by 3600. 2621 / 3600 = ~0.728056 Add fractional degrees to whole degrees to produce the final result: 87 + 0.728056 = 87.728056

Since it is a West longitude coordinate, negate the result. The final result is -87.728056.

From Wikipedia. Here's a Javascript widget that does the same thing.

like image 149
David Titarenco Avatar answered Oct 28 '22 10:10

David Titarenco