【问题标题】:Convert integer latitude and longitude to decimal (using for google maps api)将整数纬度和经度转换为十进制(用于谷歌地图 api)
【发布时间】:2016-11-13 17:17:40
【问题描述】:

目前我正在尝试将整数 latitudelongitude 转换为十进制(度)。我从中获取数据的规范说:

|纬度 |位置纬度 |整数,1/10 秒的数 |

|经度 |位置经度 |整数,1/10 秒的数 |

这是一个样本编号:

  • 纬度:1914383
  • 经度:371352

我需要的是这种格式的东西:

  • 纬度:51.39796
  • 经度:14.62539

如何转换这些格式?

我在 c# 中看到了一些实现,但没有什么对我真正有用,或者我不明白它是如何工作的。我试过的:

Converting GPS coordinates (latitude and longitude) to decimalConverting latitude and longitude to decimal values

非常感谢

【问题讨论】:

  • 因为它在 1/10 秒内给出,只需将其除以 36000。检查 API 文档中的符号是如何形成的。

标签: c# google-maps geolocation latitude-longitude


【解决方案1】:

这是格式之间转换的示例。

    private void ConvertSampleFunction()
    {
        //let N 40264600 be a GPS coordinate. Then
        //Format in degrees minutes seconds: 40° 26′ 46″ N 
        double Degs=40.0;
        double Mins=26.0;
        double Secs=46.00;
        //Then in degrees - decimal minutes Format will be
        double Ddegs=Degs;
        double Dmins=Mins;
        double Dsecs=Secs/60.0;
        //This will give Ddegs and Dmins.Dsecs e.g. 40 degrees and 26.767'
        //and In Decimal format DDD.DDD... it will be
        double DecDegs=Degs+Mins/60.0+Secs/3600.0;
        //which will give the value 40.446..
    }

希望这些帮助。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2010-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-06
    • 1970-01-01
    • 2013-01-11
    相关资源
    最近更新 更多