[GraphHopper] compyte Distance
Lau
laura.barroso at hab.desoft.cu
Wed Jul 15 12:37:47 UTC 2015
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:fredlaurent31 at gmail.com]
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/graphhopper/attachments/20150715/41b45907/attachment.html>
More information about the GraphHopper
mailing list