問題描述
尋找 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.
這篇關于如何在度、分、秒之間轉換為十進制坐標的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!