【问题标题】:How to convert geopoint longitude +latitude to double?如何将地理点经度+纬度转换为双倍?
【发布时间】:2011-06-21 14:37:56
【问题描述】:

我正在检索地图视图的中心,我需要将 longs 和 lats 作为双精度值传递给我的服务器,以便针对数据库进行测试。

我将如何将 mapView.getMapCenter().getLongitudeE6() 转换为 double ?

【问题讨论】:

    标签: java android google-maps casting


    【解决方案1】:

    调用mapView.getMapCenter() 返回GeoPointGeoPoint.getLongitudeE6()GeoPoint.getLatitudeE6() 都返回微度数(基本上是度数 * 1E6)。

    因此,在 Java 中,只需将微度转换为度:

    public static double microDegreesToDegrees(int microDegrees) {
        return microDegrees / 1E6;
    }
    

    【讨论】:

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