如何在度、分、秒之间转换为十进制坐标

2022-01-14 00:00:00 geospatial geolocation java geotools

寻找 java 实用程序.如果你能告诉我如何使用geotools库来做就更好了.

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

推荐答案

你所说的十进制坐标"是指经纬度(也称为十进制度)吗?如果是这样,那么您要做的事情就很简单了:

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:

给定一个 DMS(度、分、秒)坐标,例如 W87°43′41″,使用以下方法:计算总秒数,43′41″ = (43*60 + 41) = 2621 秒.小数部分是总秒数乘以 3600.2621/3600 = ~0.728056 将分数度数加到整数上产生最终结果的度数:87 + 0.728056 = 87.728056

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

因为是西经坐标,所以否定结果.最终结果是-87.728056.

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

来自 维基百科.这是一个 Javascript 小部件,它做同样的事情.

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

相关文章