Search code examples
python-3.xgoogle-geocoder

specific arguments for geocoder in google


import geocoder
g = geocoder.google([self.getLatitude(), self.getLongitude()], method = 'reverse')
    return g.street + " " + g.housenumber + ", " + g.postal + " " + g.city + ", " + g.country

So I have this code and my problem is, that I can't find any arguments that specify my choosen language and the length of the country in the output. Eg. I have 'CH' and I'd like to have 'Switzerland'.


Solution

  • I don't think you will get GeoCoder to do that. But you can translate the code yourself.

    $ pip install iso3166
    
    >>> from iso3166 import countries
    >>> countries.get("CH")
    Country(name='Switzerland', alpha2='CH', alpha3='CHE', numeric='756', apolitical_name='Switzerland')