我正在检索地图视图的中心,并且需要将经度和纬度作为双精度传递给我的服务器进行与数据库的测试。
如何将mapView.getMapCenter().getLongitudeE6()转换为double类型?
我正在检索地图视图的中心,并且需要将经度和纬度作为双精度传递给我的服务器进行与数据库的测试。
如何将mapView.getMapCenter().getLongitudeE6()转换为double类型?
调用mapView.getMapCenter()
会返回一个GeoPoint
。 GeoPoint.getLongitudeE6()
和GeoPoint.getLatitudeE6()
都返回微度(基本上是度数*1E6)。
因此,在Java中,将微度转换为度数只需执行以下操作:
public static double microDegreesToDegrees(int microDegrees) {
return microDegrees / 1E6;
}