558
Views
13
Comments
[Google Maps Library] Google Map Mobile Directions - Missing Waypoints
Question
google-maps-mobile
Reactive icon
Forge asset by Labs

Hi Folks,

Noticed the advanced options for directions is not being processed anywhere.

This means no support for waypoints between origin and destination.

Attached you'll find a possible solution for this


Cheers

GoogleMapsMobile.oml
UserImage.jpg
Mário Amorim

Rui Barbosa wrote:

Hi Folks,

Noticed the advanced options for directions is not being processed anywhere.

This means no support for waypoints between origin and destination.

Attached you'll find a possible solution for this


Cheers


Hi, 

I am trying to use this but i have an error,

i get this error "Error parsing options JSON string. Using default options"

I dont understand why. Can you help me?


2018-05-30 02-48-38
Rui Barbosa

Hi Mário,

Just with this error information is almost impossible to help you, but I'll do my best.

Notice the waypoints attribute description in the MapDirections structure:

In the following example, I've created an auxiliary structure to hold these waypoints, with location and stopover.

From there I collect the waypoints from a database and add them to waypoints list in a cycle.

Since the google API accepts waypoints as a JSON string, I serialize the list and add the resulting JSON text to the map directions variable.




The end result looks like this





Hope this helps


UserImage.jpg
Mário Amorim

Hi,

Yes you are correct, i gave to litle information.

Thanks a lot for your answer.

I am using the normal google maps mobile and it works perfectly with one origin and one destination, it gives the directions with no problem.

When I try to use your update it gives me thar error that i said before when i try to get the direction between a origin and a destination. 

I am doing the assignemnt like this whitout trying the waypoints, onlçy with what i had before:


Am i doing something wrong?

2018-05-30 02-48-38
Rui Barbosa

Oh, I see what you mean, you get the error when there are no waypoints.

In attach you will find a quick fix.

But please take into consideration that this is a Hack.

I was kind of hoping the team who takes care of this component would pick this up and make a proper implementation of the waypoints.

Cheers


Google Maps Mobile.oap
UserImage.jpg
Mário Amorim

Hi,

Thanks a lot for the help-

It works perfectly when i use no waypoints.

Now i am trying to use this waypoint, assigning it like this:

SyntaxEditor Code Snippet

"waypoints: [{location: 'Badajoz, Spain'}]"

It gives me yhe json string error, the same as before.

I have also tried with this one:

SyntaxEditor Code Snippet

"waypoints: [{location: 'Adelaide, SA'}, {location: 'Broken Hill, NSW'}],"

and 

SyntaxEditor Code Snippet

"waypoints: [{lat:40.6586352,lng:-4.7027486}],"

It gave me the same error.

Am i not assigning it correctly?

UserImage.jpg
Mário Amorim

Hi again,

So i think i know what i was doing wrong.

The assigning of the waypoints must be 

SyntaxEditor Code Snippet

"[{lat:40.6586352,lng:-4.7027486}]"

But i get no waypoint or directions shown in the map.

I dont get the json string error anymore 

Can you help with this?

thanks

2018-05-30 02-48-38
Rui Barbosa

Here is a working example

Cheers

WaypointsDemo.oap
UserImage.jpg
Mário Amorim

Thanks a lot.

Works perfectly now.

I am just trying to assign the start location my current location.

Do you have any idea how using the location plug in how i can do this?

I cant seem to assing the strat location my current location

Thanks a lot for your help

UserImage.jpg
Kelvin Seow

Hi,

From your post i saw your google map structure had waypoint, optimize waypoint structure. But in mine, i only see travel mode and advance options. How do i go about to set my waypoint?

2018-05-30 02-48-38
Rui Barbosa

Hi Kelvin

I'm not sure exactly what you mean.

I proposed some changes on the original component to support waypoints. Those changes did not make it to the official component, but if you look at the thread you will find the modified version on my post from Jan 9 and a simple demo on Jan 16.

Let us know if that worked.


Cheers


UserImage.jpg
Kelvin Seow

Rui Barbosa wrote:

Hi Kelvin

I'm not sure exactly what you mean.

I proposed some changes on the original component to support waypoints. Those changes did not make it to the official component, but if you look at the thread you will find the modified version on my post from Jan 9 and a simple demo on Jan 16.

Let us know if that worked.


Cheers


Hi Rui Barbosa,


I mean in your list i have attached the screenshot.You are able to save your waypoint to google map -> directions -> waypoint in your side while mine dont see it. Its the latest version already.

Thanks

2018-05-30 02-48-38
Rui Barbosa

Hi Kevin

You need the modified version of the component. Check the post from Jan 9

Cheers

UserImage.jpg
Kelvin Seow

Rui Barbosa wrote:

Hi Kevin

You need the modified version of the component. Check the post from Jan 9

Cheers

Hi Rui Barbosa,


Ok noted. Shall take a look and update. Thank you.

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.