map api v2 : GDirections() object

355 views
Skip to first unread message

vishal garg

unread,
Nov 15, 2011, 10:33:05 AM11/15/11
to google-map...@googlegroups.com, google-...@googlegroups.com, vishal...@gmail.com
I am using 'loadFromWaypoints' function of the GDirections object.
There are multiple instances of the GDirections object in the code.
Please note Gdirections object is defined in google maps api v2. E.g.

dirn1.loadFromWaypoints([p11.toUrlValue(6),p11.toUrlValue(6)],{getPolyline:true});
dirn2.loadFromWaypoints([p22.toUrlValue(6),p22.toUrlValue(6)],{getPolyline:true});

But whenever I load the page, it stops before "dirn1..."
And loads ultimately, when I add alert statements as :

alert("0a");
dirn1.loadFromWaypoints([p11.toUrlValue(6),p11.toUrlValue(6)],{getPolyline:true});
alert("0b");
dirn2.loadFromWaypoints([p22.toUrlValue(6),p22.toUrlValue(6)],{getPolyline:true});
alert("oc");
var p1 = dirn1.getPolyline().getVertex(0);
alert("0d");
var p2 = dirn2.getPolyline().getVertex(0);

Could it be a problem that I am using deprecated API (google map api
v2)? If not what is the possible solution to load the page smoothly
without using alert statements?

-vishal garg

geoco...@gmail.com

unread,
Nov 15, 2011, 10:56:16 AM11/15/11
to Google Maps JavaScript API v3
On Nov 15, 7:33 am, vishal garg <vishal17g...@gmail.com> wrote:
> I am using 'loadFromWaypoints' function of the GDirections object.
> There are multiple instances of the GDirections object in the code.
> Please note Gdirections object is defined in google maps api v2. E.g.
>
> dirn1.loadFromWaypoints([p11.toUrlValue(6),p11.toUrlValue(6)],{getPolyline:true});
> dirn2.loadFromWaypoints([p22.toUrlValue(6),p22.toUrlValue(6)],{getPolyline:true});
>
> But whenever I load the page, it stops before "dirn1..."
> And loads ultimately, when I add alert statements as :
>
> alert("0a");
> dirn1.loadFromWaypoints([p11.toUrlValue(6),p11.toUrlValue(6)],{getPolyline:true});
> alert("0b");
> dirn2.loadFromWaypoints([p22.toUrlValue(6),p22.toUrlValue(6)],{getPolyline:true});
> alert("oc");
> var p1 = dirn1.getPolyline().getVertex(0);
> alert("0d");
> var p2 = dirn2.getPolyline().getVertex(0);
>
> Could it be a problem that I am using deprecated API (google map api
> v2)?

You can't use it with v3 of the API, this group is the v3 group, the
v2 group is:

http://groups.google.com/group/google-maps-api/topics

Their posting guidelines also request a link to your map that exhibits
the problem and frown on posted code.

-- Larry

vishal garg

unread,
Nov 15, 2011, 11:36:06 AM11/15/11
to google-map...@googlegroups.com, vishal...@gmail.com
Thanks larry. I thought I would post it to both the groups, so that if
anyone who had come across it - some v3 user like me using some parts
of v2 or a v2 user. I will try posting there!

-vishal garg

> --
> You received this message because you are subscribed to the Google Groups "Google Maps JavaScript API v3" group.
> To post to this group, send email to google-map...@googlegroups.com.
> To unsubscribe from this group, send email to google-maps-js-a...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.
>
>

Rossko

unread,
Nov 15, 2011, 11:45:29 AM11/15/11
to Google Maps JavaScript API v3
> some v3 user like me using some parts
> of v2 ...

You can't use parts of v2 in v3, maybe that is your problem.

vishal garg

unread,
Nov 15, 2011, 12:44:08 PM11/15/11
to google-map...@googlegroups.com, vishal...@gmail.com
Hey rosso, by parts I meant a user who is using v3 but also knows
about v2. Interpretation problem! You can access the code at
http://web.iiit.ac.in/~vishal.gargug08/test/index.php

Let me know incase there is any problem in accessing.
Problem - the javascript stops in the middle when the page is being loaded.

-vishal garg

Rossko

unread,
Nov 15, 2011, 1:48:48 PM11/15/11
to Google Maps JavaScript API v3
> about v2. Interpretation problem! You can access the code athttp://web.iiit.ac.in/~vishal.gargug08/test/index.php

It's not a v3 map, post in the v2 group
Reply all
Reply to author
Forward
0 new messages