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
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)