google map zoom after directions

i am using google maps in order to give some directions from one point to another.

Although, i have set the zoom of the map to 15 the zoom changes after the response of the direction request in order probably to fit the directions into the map.

Does anyone nows how to keep the zoom constant at 15. and focus at the first point?

Thanks in advance.


See the documentation for the DirectionsRenderer

preserveViewport: true

will prevent the DirectionsRenderer from changing the zoom.

To center the map on the first point use the map.setCenter function. You will need to parse the response from the directions service and create a google.maps.LatLng object for the first point.

This example shows one way to parse the response:

(you don't need everything, just the location of the point you want to center on)

Need Your Help

.crx file install in chrome

google-chrome google-chrome-extension

I have just created a very simple chrome extension and it works fine. But when I converted to .crx file and try to open it with chrome, nothing happens. my chrome browser version is 19.0.1081.2 dev...

What does the generic nature of the class Class<T> mean? What is T?

java class generics reflection

I understand generics when it comes to collections. But what does it mean in the case of the Class&lt;T&gt; class? When you instantiate a Class object, there's only one object. So why the T paramet...