Google Maps choose zoom to fit country TIGHTLY in given window

前端 未结 2 906
闹比i
闹比i 2021-01-28 18:28

I am just starting out with the Google Maps API. I have successfully managed to create a map centered on a given country

function create_map (geometry) {
    var         


        
相关标签:
2条回答
  • 2021-01-28 18:48

    It's not possible. The zoom of a map may only be set to integer-values, but what you're trying to achieve would require a float-value.

    Go to http://gmaps-samples-v3.googlecode.com/svn/trunk/geocoder/v3-geocoder-tool.html#q%3Dfrance

    The blue rectangle marks the viewport, when you increase the zoom by 1 the blue rectangle will not fit into the container.

    0 讨论(0)
  • 2021-01-28 18:49

    You are using wrong object property. geometry.position is undefined. You have to use geometry.location and you will get better map without map.fitBounds()

    0 讨论(0)
提交回复
热议问题