private static Double distance(Location one, Location two) {

            int R = 6371000;

            Double dLat = toRad(two.getLatitude() - one.getLatitude());

            Double dLon = toRad(two.getLongitude() - one.getLongitude());

            Double lat1 = toRad(one.getLatitude());

            Double lat2 = toRad(two.getLatitude());

            Double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) + Math.sin(dLon 
/ 2)

                        * Math.sin(dLon / 2) * Math.cos(lat1) * Math.cos(lat2);

            Double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));

            Double d = R * c;

            return d;

      }

 

De: Fred Laurent [mailto:[email protected]] 
Enviado el: Wednesday, 15 July, 2015 7:15 AM
Para: GraphHopper Java routing engine
Asunto: [GraphHopper] compyte Distance

 

Hello , is it possible in GH to compute the distance from my current Location 
(Curreent_lat,Current_lon)to a position B(B_lat,B_lon) using CalcDist for 
example ? 

thank you

_______________________________________________
GraphHopper mailing list
[email protected]
https://lists.openstreetmap.org/listinfo/graphhopper

Reply via email to