Android Question Draw route keeping the road's/street's shape

adrianstanescu85

Active Member
Licensed User
Longtime User
Hello

I wanted to ask if anyone knows a way to draw the route on the OSM map, knowing the waypoints, so that the route respects the shape of the road.

I'm asking this since knowing the waypoints from point A to point B provide coordinates for switching from one street to the other, but a certain road/street that runs between any two waypoints has quite often an unsteady non-linear path.

Do you know a way this can be done?

Thank you!
Adrian
 

adrianstanescu85

Active Member
Licensed User
Longtime User
To picture this, here is a screenshot of plotting a route with PathOverlay.

Route%20problem.jpg


As you can see, the route doesn't stick to the actual road (i.e. Calea Sighisoarei for instance), but is a general straight line.

Any solutions on how to make this get on the actual road?

Thank you!
Adrian
 
Upvote 0

achtrade

Active Member
Licensed User
Longtime User
I need this too. Why is not this possible in B4A yet ?

When will we have something like this app ?

SyHEvUZQCIo2_FlL1DblX1kzRXIRTXRbYOcnSB1L5ZrhMoZaomI9fvJU4KvvN0LFoCVp=h900-rw
 
Upvote 0

achtrade

Active Member
Licensed User
Longtime User
I did it by using WebView, WebViewExtra, GPS and 2 lists for Latitude and longitude. Everytime the GPS location changed I stored the Lat and Lon locations in the lists, Basically what you want is this https://www.b4x.com/android/forum/threads/google-maps.20538/#post-118361.

In my case, what I need is different, knowing the point A and B, what I need is a driving route, even before to start driving, like the navigation function of Google Map, that's that pic that I posted.

Any idea ?, I'm willing to pay for such lib
 
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
Hmm Okay @achtrade,
Why don't you just do the following using a WebView then?

You will be surprised just how much you can do with a direct call to Googles URL.
B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")

    Dim WebViewAB As WebView
        WebViewAB.Initialize(Null)
   
    Activity.AddView(WebViewAB, 0dip, 0dip, 100%x, 100%y)

    Dim FromA, ToB As String
        FromA = "Birmingham"
        ToB = "London"
   
    WebViewAB.LoadUrl("http://maps.google.com?q=" & FromA & " to " & ToB)
    ToastMessageShow("Loading directions, please wait", True)
End Sub

Screenshot_2015-05-05-20-13-54.png
 
Last edited:
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
knowing the point A and B, what I need is a driving route, even before to start driving, like the navigation function of Google Map, that's that pic that I posted.
You've just been given that solution
1. How to do it using lat y lon ?
2. How to include it in the B4A GoogleMap lib ?
1. Use the GPS library to get your GPS starting position, use that starting position as FromA.
2. I do not use GoogleMap lib, I use the solution above for navigation or I use WebView and WebViewExtra for live tracking for my tracking app...
 
Upvote 0

achtrade

Active Member
Licensed User
Longtime User
where can I see your app ? what's the name ?

if my point A is 39.084511,-77.152926 and my point B is 38.991177,-77.026239

this didn't work:

B4X:
WebViewAB.LoadUrl("http://maps.google.com?q=39.084511,-77.152926 to 38.991177,-77.026239")
 
Last edited:
Upvote 0
Top