We have distance search filter. It has a map viewport that allow to set base marker and a input text box that allows enter distance in kilometers.
We then add a circle to show this distance on the map.
How can I zoom the map so it fits the circle?
We have distance search filter. It has a map viewport that allow to set base marker and a input text box that allows enter distance in kilometers.
We then add a circle to show this distance on the map.
How can I zoom the map so it fits the circle?
For multiple circles use union instead of extend:
A
google.maps.Circle
has agetBounds()
method which returns theLatLngBounds
of the circle. You may use this bounds as argument forgoogle.maps.Map.fitBounds()
If using a circle, you can do this:
...at the end of the init-function.
http://jsfiddle.net/doktormolle/MHLjy/