hookshy Well-Known Member Licensed User Longtime User Dec 16, 2013 #1 How do you calculate direction of travel using bearing ? I want to determine if the user is heading a given point of known latitude and longitude ?
How do you calculate direction of travel using bearing ? I want to determine if the user is heading a given point of known latitude and longitude ?
NJDude Expert Licensed User Longtime User Dec 16, 2013 #2 Search the forums, there are several examples. Upvote 0
Rick in North Carolina Member Licensed User Longtime User Dec 16, 2013 #3 You can use the GPS Location object: Code: Copy Sub GPS_LocationChanged (Location1 As Location) meLoc.Latitude = Location1.Latitude meLoc.Longitude = Location1.Longitude End Sub Code: Copy rvLoc.Latitude = latt rvLoc.Longitude = longt bearing = meLoc.BearingTo(rvLoc) Upvote 0
You can use the GPS Location object: Code: Copy Sub GPS_LocationChanged (Location1 As Location) meLoc.Latitude = Location1.Latitude meLoc.Longitude = Location1.Longitude End Sub Code: Copy rvLoc.Latitude = latt rvLoc.Longitude = longt bearing = meLoc.BearingTo(rvLoc)
hookshy Well-Known Member Licensed User Longtime User Dec 16, 2013 #4 Yes this is easy to calculate degree from my current location "meloc" to given point rvloc and for example if the result is 0 degree this means that the direction of the given point is north relative to my location . Problem is that this calculation isn't enough to decide if i am heading north , I may be heading 30 degree N-V . I must calculate the diference of degree from my curent direction and the direction to the given point ! I guess the question would be how to calculate the current bearing ...or where I am heading to ? May be someting is missing ...hope to find out what ! Thank you ! Upvote 0
Yes this is easy to calculate degree from my current location "meloc" to given point rvloc and for example if the result is 0 degree this means that the direction of the given point is north relative to my location . Problem is that this calculation isn't enough to decide if i am heading north , I may be heading 30 degree N-V . I must calculate the diference of degree from my curent direction and the direction to the given point ! I guess the question would be how to calculate the current bearing ...or where I am heading to ? May be someting is missing ...hope to find out what ! Thank you !
hookshy Well-Known Member Licensed User Longtime User Dec 16, 2013 #5 Code: Copy Sub Location_LocationChanged (Longitude As Double, Latitude As Double, Altitude As Double, Accuracy As Float, Bearing As Float, Provider As String, Speed As Float, Time As Long) End Sub I do not understand what is the meaning of bering in the locationchanged event when bearing is always 0 in my tests...somewere is somethin wrong Last edited: Dec 16, 2013 Upvote 0
Code: Copy Sub Location_LocationChanged (Longitude As Double, Latitude As Double, Altitude As Double, Accuracy As Float, Bearing As Float, Provider As String, Speed As Float, Time As Long) End Sub I do not understand what is the meaning of bering in the locationchanged event when bearing is always 0 in my tests...somewere is somethin wrong
Rick in North Carolina Member Licensed User Longtime User Dec 16, 2013 #6 Bearing in the LocationChanged event is valid when moving, else it is 0. Upvote 0
hookshy Well-Known Member Licensed User Longtime User Dec 17, 2013 #7 I think valid bearing is received by the location event when you request gps listennig without parameters lm.requestgpslistening(0,0) no time delay ,no distance offset ...but i must do some tests Upvote 0
I think valid bearing is received by the location event when you request gps listennig without parameters lm.requestgpslistening(0,0) no time delay ,no distance offset ...but i must do some tests