try getbounds, it will automaticly get the right zoomlevel something like that : bounds = new google.maps.LatLngBounds(StartBoundsLatlng,EndBoundsLatlng);
look up the docu, its fairly easy to implement On 15 Jan., 18:21, dipens <goo...@differentum.com> wrote: > Hi, > > I call the Directions API (through PHP) - which returns an encoded > polyline and level. > (I also have to call it through PHP so carry out some 'on-the-fly' > processing.) > I then store this data in a session and then display a map. > > To avoid calling the directions API again (unnecessarily) I give the > polyline and level data to javascript - which then calls the google's > Javascript API to display the route on the map. > > The problem I am facing is that the map is not being displayed at the > same zoom level than if I were to call the Directions API through > google's Javascript API. > > Examples: > > If calling Directions API through Javascript API: > > http://www.differentum.com/map-test.html > > If drawing the route using the polyline I have in the cache: > > http://www.differentum.com/map-test2.html > > As you can see, I do not know how to pass the encoded level to the > Javascript API so that it can zoom it to the correct level. > > Can anyone tell me what I am doing wrong? > > Thanks > Dipen -- 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-maps-js-api-v3@googlegroups.com. To unsubscribe from this group, send email to google-maps-js-api-v3+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-maps-js-api-v3?hl=en.