Difference between viewport and bounds in google geocoding

Ivan Kochurkin picture Ivan Kochurkin · Feb 21, 2013 · Viewed 11.8k times · Source

What the difference between viewport and bounds rects in google geocoding api?

For big countries (USA, Russia) viewport differs from bounds (sample request for Canada: http://maps.googleapis.com/maps/api/geocode/xml?address=Canada&sensor=false, but for smaller countries, regions and cities they are equal.

Answer

Soliyappan picture Soliyappan · Nov 4, 2016

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