如何在谷歌地图中的两个点范围之间进行选择。例如:50m 或 100m
我正在使用此代码来计算距离。
public class DistanceCalculator {
public static final double Radius = 6378.1;
public double CalculationByDistance(GeoPoint startp, GeoPoint endp) {
double lat1 = startp.getLatitudeE6()/1E6;
double lat2 = endp.getLatitudeE6()/1E6;
double lon1 = startp.getLongitudeE6()/1E6;
double lon2 = endp.getLongitudeE6()/1E6;
double dLat = Math.toRadians(lat2-lat1);
double dLon = Math.toRadians(lon2-lon1);
double a = Math.sin(dLat/2) * Math.sin(dLat/2) +
Math.cos(Math.toRadians(lat1)) * Math.cos(Math.toRadians(lat2)) *
Math.sin(dLon/2) * Math.sin(dLon/2);
double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
return Radius * c;
}
}