Hi,
I’m sorry to inform you that, ILocation.Calculate() issue has been analyzed, but unfortunately it will not be fixed as WRT is no longer in active development. As a workaround I would suggest using a pure JavaScript implementation to calculate the distance between two points.
Code:
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/* Latitude/longitude spherical geodesy formulae & scripts (c) Chris Veness 2002-2009 */
/* http://www.movable-type.co.uk/scripts/latlong.html */
/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
function distHaversine(lat1, lon1, lat2, lon2) {
var R = 6371; // earth's mean radius in km
var dLat = toRad(lat2-lat1);
var dLon = toRad(lon2-lon1);
lat1 = toRad(lat1), lat2 = toRad(lat2);
var a = Math.sin(dLat/2) * Math.sin(dLat/2) + Math.cos(lat1) * Math.cos(lat2) * Math.sin(dLon/2) * Math.sin(dLon/2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var d = R * c;
return d;
}
// extend Number object with methods for converting degrees/radians
function toRad (deg) { // convert degrees to radians
return deg * Math.PI / 180;
}
You can also check Location API simulation file in C:\Program Files (x86)\Nokia Web Tools 1.2.0\Web App Simulator\platformservices\api\wrt11\Location.js to see how bearing can be calculated.
edit:
Ps.
Thanks Shpe for the snippet. I should have refreshed the page before posting
Br,
Ilkka