Skip to content
Snippets Groups Projects
Commit d8c3ce1a authored by kraleva's avatar kraleva
Browse files

add distance in meters

parent 21c139b1
No related branches found
No related tags found
1 merge request!22add distance in meters
...@@ -20,7 +20,7 @@ public class ComputationalUtils { ...@@ -20,7 +20,7 @@ public class ComputationalUtils {
// do this for each node and its successor in the (sorted) node list for each // do this for each node and its successor in the (sorted) node list for each
// segment and then add it all together // segment and then add it all together
public static double haversine(float lat1, float lon1, float lat2, float lon2) { public static double haversine(float lat1, float lon1, float lat2, float lon2) {
final int R = 6371; // Radious of the earth final int R = 6371000; // Radious of the earth
float latDistance = toRad(lat2 - lat1); float latDistance = toRad(lat2 - lat1);
float lonDistance = toRad(lon2 - lon1); float lonDistance = toRad(lon2 - lon1);
float a = (float) (Math.sin(latDistance / 2) * Math.sin(latDistance / 2) + float a = (float) (Math.sin(latDistance / 2) * Math.sin(latDistance / 2) +
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment