如何将localoint经度+纬度转换为double?

mol*_*man 4 java android google-maps casting

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

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

Rob*_*rop 16

呼叫mapView.getMapCenter()返回a GeoPoint.GeoPoint.getLongitudeE6()并且GeoPoint.getLatitudeE6()都返回微度(基本上是度*1E6).

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

public static double microDegreesToDegrees(int microDegrees) {
    return microDegrees / 1E6;
}
Run Code Online (Sandbox Code Playgroud)