Difference between viewport and bounds in google geocoding

13,294

Solution 1

I think that if the viewport and the bounds are not the same for big countries is just because they can not be display with the default zoom. So the bounds are correct for the current view but the whole country will not be displayed.

For the viewport, it's just the minimum bound to display the whole country.

Hope i answer your question.

Solution 2

Viewport contains the recommended viewport for displaying the returned result, specified as two latitude, longitude values defining the southwest and northeast corner of the viewport bounding box. Generally the viewport is used to frame a result when displaying it to a user.

Bounds stores the bounding box which can fully contain the returned result. Note that these bounds may not match the recommended viewport. (For example, San Francisco includes the Farallon islands, which are technically part of the city, but probably should not be returned in the viewport)

For more info: https://developers.google.com/maps/documentation/geocoding/intro#Results

Share:
13,294
Ivan Kochurkin
Author by

Ivan Kochurkin

My articles: https://github.com/KvanTTT/Articles

Updated on June 05, 2022

Comments