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.
In virtual desktops, the viewport is the visible portion of a 2D area which is larger than the visualization device. When viewing a document in a web browser, the viewport is the region of the browser window which contains the visible portion of the document.
If you exceed the per-day limit or otherwise abuse the service, the Google Maps Geocoding API may stop working for you temporarily. If you continue to exceed this limit, your access to the Google Maps Geocoding API may be blocked.
Stay organized with collections Save and categorize content based on your preferences. Geocoding is the process of converting addresses (like a street address) into geographic coordinates (latitude and longitude), which you can use to place markers on a map, or position the map.
Go to the Google Cloud Console. Click the Select a project button, then select the same project you set up for the Maps JavaScript API and click Open. From the list of APIs on the Dashboard, look for Geocoding API. If you see the API in the list, you're all set.
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With