Looking for a java utility. It is even better if you can tell me how to do it using geotools library.
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.
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.
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.728056Since 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With