Hi, Thanks. I have got a little further - and I think that I am almost there.
Please see: http://www.differentum.com/map-test3.html (I have set the 'zoom: 1' on purpose as I want to make sure that my function is zooming in at the correct zoom level.) I am getting a 'stack overflow' error when trying to execute map.fitBounds (bounds); - which I think should be the piece of code that zooms in at the correct level. I don't know why this is. I have tried to work out how I can use getBounds() to achieve this - but I need to call it after passing the Javascript API my marker positions - which is why I thought I should use fitbounds? I would be very grateful if someone can take a look at this for me. Thanks! On Jan 15, 7:40 pm, en4ce <djen...@googlemail.com> wrote: > 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- Hide quoted text - > > - Show quoted text - -- 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.