Hello!
I'm working on a navigation app using Google Directions.
After decoding json result i decode polyline points and store them in lMapsPoints list.
So i'm, able to draw the route to maps and do maneuver infos when i'm nearby an maneuver point.
Now i want to use these polyline points to check if i'm off the route (f.e. distance < 10 meters). If i'm off the route i do a new google directions request so the idea.
But if there is a long line between two polyline points f.e. on a highway, i'm off the route on checking the next polyline point.
So i will fill up the list with points. But i do not know how to calc a new gps point which should be in the middle of two other gps points.
My MapsVerifyPoints sub looks like following:
Is there already any function available for calculating this?
Martin
I'm working on a navigation app using Google Directions.
After decoding json result i decode polyline points and store them in lMapsPoints list.
So i'm, able to draw the route to maps and do maneuver infos when i'm nearby an maneuver point.
Now i want to use these polyline points to check if i'm off the route (f.e. distance < 10 meters). If i'm off the route i do a new google directions request so the idea.
But if there is a long line between two polyline points f.e. on a highway, i'm off the route on checking the next polyline point.
So i will fill up the list with points. But i do not know how to calc a new gps point which should be in the middle of two other gps points.
My MapsVerifyPoints sub looks like following:
B4X:
For j = 0 To (lMapsPoints.Size - 1) / 2 Step 2
mpiPoint1 = lMapsPoints.Get(j)
mpiPoint2 = lMapsPoints.Get(j + 1)
lPoint1.Latitude = mpiPoint1.dLatitude
lPoint1.Longitude = mpiPoint1.dLongitude
lPoint2.Latitude = mpiPoint2.dLatitude
lPoint2.Longitude = mpiPoint2.dLongitude
fDistance = lPoint1.DistanceTo(lPoint2) ' meters
If fDistance > 10 Then ' distance to big for "route off" calc
iNumberPoints = iNumberPoints + 1
Log("Points " & j & " " & (j + 1) & ": Distance=" & NumberFormat2(fDistance,0,0,0,False))
'lMapsPoints.InsertAt ???
End If
Next
Log("NumberPoints=" & iNumberPoints & "/" & lMapsPoints.Size)
Is there already any function available for calculating this?
Martin