Missing Speed in Location info. How to calculate this?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
mtimmerm
Posts: 14
Joined: Tue Nov 15, 2011 12:56 pm

Missing Speed in Location info. How to calculate this?

Post by mtimmerm » Thu Apr 19, 2012 7:49 pm

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?

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

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

Post by Dixie » Thu Apr 19, 2012 9:51 pm

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

mtimmerm
Posts: 14
Joined: Tue Nov 15, 2011 12:56 pm

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

Post by mtimmerm » Fri Apr 20, 2012 12:10 pm

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.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

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

Post by Dixie » Fri Apr 20, 2012 1:21 pm

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
Attachments
latlong.livecode.zip
(1.88 KiB) Downloaded 259 times

mtimmerm
Posts: 14
Joined: Tue Nov 15, 2011 12:56 pm

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

Post by mtimmerm » Fri Apr 20, 2012 2:48 pm

Thanks, I will take a look to it.

No problem.

mtimmerm
Posts: 14
Joined: Tue Nov 15, 2011 12:56 pm

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

Post by mtimmerm » Sun Apr 22, 2012 2:19 pm

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.

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

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

Post by Dixie » Sun Apr 22, 2012 3:29 pm

Hi...

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

be well

Dixie

mtimmerm
Posts: 14
Joined: Tue Nov 15, 2011 12:56 pm

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

Post by mtimmerm » Wed Apr 25, 2012 1:52 pm

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 :(

Dixie
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1336
Joined: Sun Jul 12, 2009 10:53 am

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

Post by Dixie » Wed Apr 25, 2012 2:10 pm

Would you like to post your script ?

be well

Dixie

Post Reply