gpt4 book ai didi

android - 如何在 Android 上为谷歌地图获取 E6 格式的经度纬度

转载 作者:可可西里 更新时间:2023-11-01 18:56:52 26 4
gpt4 key购买 nike

我如何找出某个位置的经纬度的SPECIFIC E6 值。例如,我在谷歌上搜索了巴拉圭首都亚松森的 long-lat。它返回我:

巴拉圭亚松森的纬度和经度是 25°16' S, 57°40 W

现在我如何将这种 long-lat 格式转换为 android 理解的 long-lat 的 E6 格式? E6 到底是什么东西?

[附注我还用谷歌搜索了亚松森的 E6 long-lat.......没有运气]

最佳答案

所以这是一个两步过程 - thanks to hooked82's answer


第 1 步. 从 DMS 到十进制度数的转换 From Wikipedia

Given a DMS (Degrees, Minutes, Seconds) coordinate such as 87°43′41″ W, it's trivial to convert it to a number of decimal degrees using the following methods:

  • Total number of degrees
    = 87
  • Total number of seconds
    = 43′41″ = (43*60 + 41*1) = 2621 seconds.
  • The fractional part is total number of seconds divided by 3600
    = 2621 / 3600 = 0.728056
  • Add fractional degrees to the whole degrees to produce the final result
    = 87 + 0.728056 = 87.728056.
  • Since it is a West longitude coordinate, negate the result.
    = -87.728056.
  • 经纬度引用:

    Lat.  North = +
    Lat. South = -
    Long. East = +
    Long. West = -

    第 2 步。从十进制转换为微度(E6 格式) From SO discussion

    MicroDegrees (the E6 format) = DecimalDegrees * 1e6
    --- as mentioned in AndroidDevGuide as well

    因此,

    float lat   = -23.4456f;   //in DecimalDegrees
    float lng = 45.44334f; //in DecimalDegrees
    GeoPoint gp = new GeoPoint((int)(lat * 1E6), (int)(lng * 1E6));

    关于android - 如何在 Android 上为谷歌地图获取 E6 格式的经度纬度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7049966/

    26 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com