Search code examples
google-cloud-platformgoogle-searchgoogle-cloud-vision

How to Set Region when using Cloud Vision API Web Entities Detection


Is there a way of setting a region when using Cloud Vision API, more specifically when detecting web entries and pages?

I consider it an important feature as Google search always considers the geo-location of a user when trying to display more relevant pages.

If not, what is the region used when triggering the API?

Thanks for all inputs!


Solution

  • There are two specific questions here and let me attempt to answer that:

    • what is the region used when triggering the API? : The specific API here is the Vision API. It is possible to restrict the API request/response processing to a specific region. By default, it is a global endpoint but specifically for Text based OCR, you can specify eu or us. Check this link: https://cloud.google.com/vision/docs/pdf#locations.

    • Specifically for web entities, you cannot set the region while invoking the API. What you could do is to give the API a hint to use geo information in the images and then more relevant search results vis-a-vis the geotagging information available in the images can be returned. The specific element is 'includeGeoResults': true in your request. Check this link: https://cloud.google.com/vision/docs/detecting-web#using_geographic_metadata_with_a_local_image