Android Question googlemaps question

tufanv

Expert
Licensed User
Longtime User
Hello,

I searhed for the tutorials but couldnt find any. Is there a way to draw the route of the gps device travelled. for example when the app started at point a , during the travel the app will draw a route ( like a line ) and when the travel finished it will stop drawing

Need oyur ideas or if there is a tutorial i couldnt find please point me

TY !
 

Ohanian

Active Member
Licensed User
Longtime User
Hi,

Here's a quick guide :

B4X:
Dim Direction As Polyline
Direction = GoogleMap1.AddPolyline

Dim llPoint As LatLng
Dim points As List

points.Initialize

llPoint.Initialize(mpiCurrent.dLatitude, mpiCurrent.dLongitude)  <<Add Your Points
points.Add(llPoint)

Direction.points = points
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
I tried it and it works perfect ty but is there any way to change the color ( it is always black ) and is there any way to have the line on the road ( because of little gps mistakes the route driven is gets out of the way a bit ) ty

 
Upvote 0

eurojam

Well-Known Member
Licensed User
Longtime User
color is no problem:
B4X:
    line = GoogleMap1.AddPolyline
    line.color= Colors.Red

to put it on the street is more complex, one way to solve it, is using a routing service. you can try https://mapmatching.3scale.net/ for example, problem, that the routing is performed with OSM, so the route will not match the the google map in all cases. Other possibility is to use google routing service between each two gps points, which will provide the segments for your route.

hope this helps
stefan
 
Upvote 0

tufanv

Expert
Licensed User
Longtime User
I am using this technique to draw the way traveled. can i store this points with a mysql table to later display the route again ? or there will be so many points so that i wont be able to store them ?
Is there any better way for it
?
ty
 
Upvote 0

eurojam

Well-Known Member
Licensed User
Longtime User
ty,
IMO storing of the points is no problem, no big data at all. you can store them either as json on the device...ask me for information if needed
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…