Page 1 of 1

Missing Speed in Location info. How to calculate this?

Posted: Thu Apr 19, 2012 7:49 pm
by mtimmerm
Hi,

I am missing the speed attribute in the LOcation Info (iOS iPhone). So I did a calculation for the speed (remember the old Long/Lat, calc the distance and device by the time between the old and new coordinates). But this seems to be very inaccurate.

Anyone a better solution?

Re: Missing Speed in Location info. How to calculate this?

Posted: Thu Apr 19, 2012 9:51 pm
by Dixie
Hi...

Why do you think it is inaccurate ? Is the calculation determining the speed, calculating the distance 'as the crow flies' instead of doing it from point A to B using the distance you would have covered on the road, as it were ?

Dixie

Re: Missing Speed in Location info. How to calculate this?

Posted: Fri Apr 20, 2012 12:10 pm
by mtimmerm
Hi,

Yes, that is the reason. It calculates from a point A to B in a straight line. this won't work if there is a curve in the road. Unless you get updates very quickly. But sometimes it takes 3 seconds before I get a location message again.

Re: Missing Speed in Location info. How to calculate this?

Posted: Fri Apr 20, 2012 1:21 pm
by Dixie
Hi..

I have attached a stack that might point you in a direction to sort out your problem. I used this when I was first trying to find out how to get liveCode to play nicely with 'google maps.

Put your 'start' point into fld "start" and your destination into fld "stop"… Clicking the button 'locate' will calculate the distance between the two points, not in a straight line but the distance on the road.

So, for example, if you entered 'Wells,UK' into fld "start" and 'Shepton Mallet,UK' into fld "stop" it will return the distance between the two towns. You do not have to use the names of the towns as they could be substituted for latitude and longitude coordinates… I think that you should be able to adapt the script in the 'locate' button to use the 'old coordinate', 'new coordinate' routine to calculate what the distance is between two points on the road rather than in the straight line.

I'm sorry, but I don't have the time to sit down and script it for you at the moment, but it might give you some ideas...

be well

Dixie

Re: Missing Speed in Location info. How to calculate this?

Posted: Fri Apr 20, 2012 2:48 pm
by mtimmerm
Thanks, I will take a look to it.

No problem.

Re: Missing Speed in Location info. How to calculate this?

Posted: Sun Apr 22, 2012 2:19 pm
by mtimmerm
Hi,

Did was also to slow. I am conintues displaying the speed. I am wondering why did LC not add this to the location info. It is already a while to this object.

Re: Missing Speed in Location info. How to calculate this?

Posted: Sun Apr 22, 2012 3:29 pm
by Dixie
Hi...

How quick do you want it to be ?... that routine takes between 91 - 107 millisecs to complete

be well

Dixie

Re: Missing Speed in Location info. How to calculate this?

Posted: Wed Apr 25, 2012 1:52 pm
by mtimmerm
Hi,

Well I guess it is the speed. I am driving on a highway (120KM/H) and it is going from 90-140.

So I really need to have the speed property on LCLOcation info. Which is unfortunatly not implemented in LC :(

Re: Missing Speed in Location info. How to calculate this?

Posted: Wed Apr 25, 2012 2:10 pm
by Dixie
Would you like to post your script ?

be well

Dixie