0

How do you limit the result of geolocator.geocode() to a certain country only in geopy Python?

geocode
  • 1
  • 3
  • Hi! welcome to SO! This is a valid topic but you should check out [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve) and provide an example of what you are trying to do. It will attract more attention. – rll Mar 18 '17 at 10:39
  • You should make clear if you want to just filter the results or limit the query. – rll Mar 18 '17 at 10:43

1 Answers1

1

That would depend on a particular geocoder you want to use.

For example with geopy.geocoders.GoogleV3, the geocode method accepts parameters bounds and region using which one can supply a particular area of interest. These parameters map directly to those exposed by the Google API. However, as the Google documentation states:

This parameter will only influence, not fully restrict, results from the geocoder.

More details can be found in the Region Biasing section.

ewcz
  • 12,819
  • 1
  • 25
  • 47