DirectionsRenderer - centers map

114 views
Skip to first unread message

Marieke Hollevoet

unread,
Mar 15, 2011, 3:09:02 PM3/15/11
to Google Maps JavaScript API v3
Hello

I've created multiple routes, by calling the DirectionsRenderer
multiple times.
Each time google maps centers on the last route of the
directionsRenderer. Is it possible to center the map on a specific
spot afterwards? I've tried this with the center_changed event, but
for some reason I get stuck in an infinite loop.

My map has different types of streets, which I want to color
accordingly. I guess using the DirectionsRenderer is the best way to
do this?

Thank you for your help
Marieke

Rossko

unread,
Mar 15, 2011, 4:09:51 PM3/15/11
to Google Maps JavaScript API v3
> Each time google maps centers on the last route of the
> directionsRenderer. Is it possible to center the map on a specific
> spot afterwards?

You could take a different approach, centre it first and prevent the
directionsRenderer changing it by using the preserveViewport option
http://code.google.com/apis/maps/documentation/javascript/reference.html#DirectionsRendererOptions


>  I've tried this with the center_changed event, but
> for some reason I get stuck in an infinite loop.

Yup, if you change the centre you get a center_changed event ...

> My map has different types of streets, which I want to color
> accordingly. I guess using the DirectionsRenderer is the best way to
> do this?

I doubt it, you will probably quickly use up your quota
Reply all
Reply to author
Forward
0 new messages