How to convert geopoint longitude +latitude to double?

大城市里の小女人 提交于 2019-12-30 07:03:26

问题


I am retrieving the center of a map view and i need to pass the longs and lats as doubles to my server for testing against the database .

How would i go about converting mapView.getMapCenter().getLongitudeE6() to a double ?


回答1:


Calling mapView.getMapCenter() returns a GeoPoint. GeoPoint.getLongitudeE6() and GeoPoint.getLatitudeE6() both return microdegrees (basically degrees * 1E6).

So, in Java, to convert microdegrees to degrees simply do:

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


来源:https://stackoverflow.com/questions/6427098/how-to-convert-geopoint-longitude-latitude-to-double

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!