【问题标题】:Converting DDM to DEC (Decimal degrees)将 DDM 转换为 DEC(十进制度)
【发布时间】:2015-01-09 06:30:12
【问题描述】:

我有一组格式为 DDM(十进制度数)的坐标,我需要将其转换为十进制度。 从 here 找到的函数中,我可以转换 DMS,但我没有找到可以让我将 DDM 转换为 DEC 的函数或公式。

例如坐标可以是:

64 度 0 分 N,22 度 33 分 W

从转换工具here知道结果是:64,-22,55

所以问题是如何转换 DDM 格式?

编辑:

数据来自如下表:

[Latitude_degrees]: 64
[Latitude_minutes]: 0
[Latitude_hemisphere]: N
[Longitude_degrees]: 22
[Longitude_minutes]: 33
[Longitude_hemisphere]: W

【问题讨论】:

  • 您是否确实有一个字符串值“64 度 0 分 N,22 度 33 分 W”?如果是这样,您需要提取数字,以及 N/S 和 E/W(使用 sscanf 或 regexps 轻松完成)......这是您的起点;那么这都是简单的数学
  • 数据来自如下表:[Latitude_degrees] [Latitude_minues] [Latitude_hemisphere] 64,0,N [Longitude_degrees] [Longitude_minutes] [Longitude_hemisphere] 22,33,W
  • 然后是简单的数学运算:Latitude = Latitude_degrees + Latitude_minutes / 60 和 if Latitude_hemisphere = 'S' 然后 Latitude = -Latitude.... 和经度的等价物
  • 这似乎有效。你能把它放在答案中吗,非常感谢你:)

标签: php coordinates geo degrees


【解决方案1】:

简单的数学

作为伪代码:

Latitude = Latitude_degrees + Latitude_minutes / 60 
if Latitude_hemisphere = 'S' then 
    Latitude = -Latitude

和经度的等价物

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-10-27
    • 2021-04-01
    • 2021-09-23
    • 1970-01-01
    • 2017-03-23
    • 1970-01-01
    • 2022-07-13
    相关资源
    最近更新 更多