Map Direction using Mapbox

plugins
ios
nativescriptcore
android

#1

Hi,

How can I implement the nativescript map direction with mapbox.

I follow the demo here in https://github.com/EddyVerbruggen/nativescript-directions/
but it doesn’t work.

Please help.

Thank you and God bless,
Yugo


#2

Check out this demo: https://github.com/EddyVerbruggen/nativescript-pluginshowcase/blob/b295e0f370248c230b290927e0a38b857363fbe6/app/mapping/mapping.component.ts#L102-L107


#3

Hi Eddy,

Thank you very much for your response.
Can I integrate the map direction using only the mapbox without opening the google map app?

Regards,
Yugo


#4

I’m not 100% sure I get your question. What’s the exact use case? Anyway, you can use the directions plugin with or without showing a map first.


#5

Because I want to build an app like uber which has a map direction. I wonder how to apply that in mapbox.

Here’s the sample photo: https://raw.githubusercontent.com/akexorcist/Android-GoogleDirectionLibrary/master/image/google-direction-library_01.jpg

Thank you,
Yugo


#6

You can’t use the direction plugin for that, you have to use the Google’s rest apis to fetch the routes between destination and draw lines yourself with the points returned. I’m not sure if MapBox has it’s own apis for same.


#7

Indeed. That’s not what the directions plugin is for. This is simply a polyline with 2 markers.


#8

Hi @Eddy,

I use polyline for the direction.
But it shows straight line.

How can I get the exact map direction?

Here is what i get:

I want an output like this:

Can you give me an example on how to do this using mapbox.

Here’s the response I get from Mapbox API but the problem is I do not know where to put this response in my mapbox code:
Here’s the link for the response :
https://drive.google.com/open?id=1ry3BVylo8pykN0_4QLq254GWVUwARvW7

I really need your help guys.

Thank very much,
Yugo


#9

@Yugo in that doc there’s an array of coordinates (conveniently named coordinates) . Can you try adding those as points here?


#10

Thank you very much @Eddy.
You saved my day.

Is it possible to animate/move the marker from Point A to Point B?

Thank you,
Yugo


#11

Not through the plugin. Perhaps not even directly with the Mapbox SDK.


#12

Hi @Eddy,
Do you have any suggestion for this?

Regards,
Yugo