public static double toRad(double value) { return value * Math.PI / 180; } public static double getDistanceM( double lat1, double lon1, double lat2, double lon2 ) { final int R = 6371000; double latDistance = toRad(lat2-lat1); double lonDistance = toRad(lon2-lon1); double a = Math.sin(latDistance / 2)*Math.sin(latDistance / 2) + Math.cos(toRad(lat1)) * Math.cos(toRad(lat2)) * Math.sin(lonDistance / 2) * Math.sin(lonDistance / 2); double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); double distance = R * c; return distance; }
Monday, January 28, 2013
Calculando la distancia entre coordenadas utilizando Haversine en Java
Haversine Fomula
Subscribe to:
Post Comments (Atom)
SQLCIPHER PHP 7.4 UBUNTU
This took me too much time to implement, after two hours of searching, I didnt found and documentation of how to compile sqlcipher support ...
-
This took me too much time to implement, after two hours of searching, I didnt found and documentation of how to compile sqlcipher support ...
-
Se ocupa utilizar cursores al momento de realizar una consulta en una tabla grande, antes de utilizar cursores se debe cumplir los siguiente...
-
Para encontrar el punto medio de dos coordanadas, tomando como referencia esta pagina movable-type.co.uk public static void midPoin...
No comments:
Post a Comment