ILocation.Calculate() doesn't work anymore with Symbian Anna
ILocation.Calculate() doesn't seem to work anymore.
When I use "MoveCoordinates" it only returns integer values that are completely useless as geocoordinates.
It worked properly before the update.
"FindDistance" and "FindBearingTo" doesn't seem to work either but I didn't have time yet to figure that out completely.
Is there any hint how to get it working again?
Re: ILocation.Calculate() doesn't work anymore with Symbian Anna
Welcome to Forum!
Could you tell what device you used to test it? (model, firmware version and browser version)
I tested with N8 having Symbian Anna and it is definitely broken.
FindDistance does not return error code but only returns 0 meters as as distance between two points.
FindBearing Says that input parameters are bad (1002), but same code does work on emulator/older devices.
Move behaves more interesting way. With my test data I could almost get the correct result, but not completely. Can you share source coordinate, distance & bearing you used in testing, to see if I could get it to return useless data as well?
Br,
Ilkka
Re: ILocation.Calculate() doesn't work anymore with Symbian Anna
Thanks for your reply!
I'm also using an N8 with Anna.
I found out, that all functions expecting coordinates as an argument don't work anymore. So "addLandmark" doesn't work either.
It makes no difference if you are using Platformservices 1.0 (1.1) or 2.0. Nothing works.
The exact problem is, that those functions parse an integer out of the given argument.
So if you calculate the distance between (49.123 | 7.123) and (49.456 | 7.456) it only calculates the distance between (49 | 7) and (49 | 7) and that is zero (0 meters).
The same with "addLandmark": I want to save a landmark at (49.123 | 7.123) but it only saves (49 | 7). That's what I called useless integer values.
So the key question is, how to provide the arguments in a way the functions accept them.
Hope someone can help.
Regards
Benjamin
Re: ILocation.Calculate() doesn't work anymore with Symbian Anna
I have the same problem. Is it solved or answered in any way?
Re: ILocation.Calculate() doesn't work anymore with Symbian Anna
yes, same here...
I calculate the distance like this:
[code]
var R = 6371; // km
var dLat = (LAT-LAT0)*Math.PI/180;
var dLon = (LNG-LNG0)*Math.PI/180;
var lat1 = LAT0*Math.PI/180;
var lat2 = LAT*Math.PI/180;
var a = Math.sin(dLat*.5) * Math.sin(dLat*.5) + Math.sin(dLon*.5) * Math.sin(dLon*.5) * Math.cos(lat1) * Math.cos(lat2);
var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
var d = R * c;
return d*1000;
[/code]
where the 2 points are at this coords: LAT,LON and LAT0,LON0
[QUOTE=b.butz;857334]ILocation.Calculate() doesn't seem to work anymore.
When I use "MoveCoordinates" it only returns integer values that are completely useless as geocoordinates.
It worked properly before the update.
"FindDistance" and "FindBearingTo" doesn't seem to work either but I didn't have time yet to figure that out completely.
Is there any hint how to get it working again?[/QUOTE]
Re: ILocation.Calculate() doesn't work anymore with Symbian Anna
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;
}
[/code]
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