2
votes

Is there a way to determine static Google map's zoom level which Google sets it by default for best fit.

I want to display the static map with selected zoom level in select option box.

For ex: For below Static Map, Google has chosen zoom level of 15.

https://maps.googleapis.com/maps/api/staticmap?key=AIzaSyDl_HSyk4C2MdhzNIur6fMj-jhRTTVjd58&size=490x640&maptype=roadmap&markers=scale:2|12.10626240,-68.93910320&markers=scale:2|12.10555400,-68.93314500&markers=scale:2|12.10509740,-68.93377480&markers=scale:2|12.10573060,-68.94097440&markers=scale:2|12.10701300,-68.93240400&markers=scale:2|12.12509600,-68.92307300&markers=scale:2|12.10557200,-68.93322700&markers=scale:2|12.10327700,-68.92828200&markers=scale:2|12.10326160,-68.92827090&markers=scale:2|12.10990400,-68.93834300&markers=scale:2|12.10573200,-68.93849500&markers=scale:2|12.10849100,-68.93637800&markers=scale:2|12.10688160,-68.93691380&scale=2&style=feature:all

One possible way is to draw a dynamic Google map and find its zoom level using JavaScript. But I want to avoid this as it takes little time to load the page.

Is this possible using the static map API or any other alternative to achieve the same?

I am using PHP and JavaScript for this project.

Any help is very much appreciated!

1

1 Answers

1
votes

Solution: Zoom Level Google Maps Static API

To set up a custom zoom level, one needs to just add a "zoom" parameter to the request you are making. Thus, if your desired Zoom Level is say, "13"..

The URL

Does this answer the question?