读书人

依据Latitude/Longitude 计算方位距

发布时间: 2012-10-16 09:57:37 作者: rapoo

根据Latitude/Longitude 计算方位,距离等
里面有详细的说明http://www.movable-type.co.uk/scripts/latlong.html
比如计算距离
方法一,

public static String getDirection(float baseAzimuth){String bearingText = "";    if ( (360 >= baseAzimuth && baseAzimuth >= 337.5) || (0 <= baseAzimuth && baseAzimuth <= 22.5) ) bearingText = "N";    else if (baseAzimuth > 22.5 && baseAzimuth < 67.5) bearingText = "NE";    else if (baseAzimuth >= 67.5 && baseAzimuth <= 112.5) bearingText = "E";    else if (baseAzimuth > 112.5 && baseAzimuth < 157.5) bearingText = "SE";    else if (baseAzimuth >= 157.5 && baseAzimuth <= 202.5) bearingText = "S";    else if (baseAzimuth > 202.5 && baseAzimuth < 247.5) bearingText = "SW";    else if (baseAzimuth >= 247.5 && baseAzimuth <= 292.5) bearingText = "W";    else if (baseAzimuth > 292.5 && baseAzimuth < 337.5) bearingText = "NW";        return bearingText;}


都可以在里面找到答案

读书人网 >移动开发

热点推荐