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
Rui Barbosa wrote:
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?
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
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?
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.
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:
"waypoints: [{location: 'Adelaide, SA'}, {location: 'Broken Hill, NSW'}],"
and
"waypoints: [{lat:40.6586352,lng:-4.7027486}],"
It gave me the same error.
Am i not assigning it correctly?
Hi again,
So i think i know what i was doing wrong.
The assigning of the waypoints must be
"[{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
Here is a working example
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
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?
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.
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
Hi Kevin
You need the modified version of the component. Check the post from Jan 9
Ok noted. Shall take a look and update. Thank you.