如何在度,分,秒之间转换为十进制坐标 [英] how to convert between degrees, minutes, seconds to Decimal coordinates

查看:218
本文介绍了如何在度,分,秒之间转换为十进制坐标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

寻找一个java实用程序。如果你能告诉我如何使用geotools库,那更好。

解决方案

通过十进制坐标经度和纬度(也称为小数)?如果是这样,你想要做的事很容易:


给定一个DMS(度,分,秒)坐标,如W87 °43'41,
使用
以下方法将其转换为十进制度数很简单:
计算秒的总数, 43'41 =(43 * 60 + 41)= 2621 秒。小数部分是总分秒数除以3600美元
。2621/3600 =〜0.728056将分数度加到整个
度以产生最终结果:87 + 0.728056 = 87.728056

因为它是一个西经坐标,所以否定了结果。
最终结果是-87.728056。

来自 Wikipedia 。这是一个 Javascript小部件,可以做同样的事情。


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:

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.

这篇关于如何在度,分,秒之间转换为十进制坐标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆