【发布时间】:2011-06-21 14:37:56
【问题描述】:
我正在检索地图视图的中心,我需要将 longs 和 lats 作为双精度值传递给我的服务器,以便针对数据库进行测试。
我将如何将 mapView.getMapCenter().getLongitudeE6() 转换为 double ?
【问题讨论】:
标签: java android google-maps casting
我正在检索地图视图的中心,我需要将 longs 和 lats 作为双精度值传递给我的服务器,以便针对数据库进行测试。
我将如何将 mapView.getMapCenter().getLongitudeE6() 转换为 double ?
【问题讨论】:
标签: java android google-maps casting
调用mapView.getMapCenter() 返回GeoPoint。 GeoPoint.getLongitudeE6() 和 GeoPoint.getLatitudeE6() 都返回微度数(基本上是度数 * 1E6)。
因此,在 Java 中,只需将微度转换为度:
public static double microDegreesToDegrees(int microDegrees) {
return microDegrees / 1E6;
}
【讨论】: