Skip to content

ijsbol/pygeolocate

Repository files navigation

pygeolocate

pip install -U pygeolocate or python -m pip install -U pygeolocate


Support server:

What is pygeolocate?

Pygeolocate is a simple Python module that allows for developers to get the longitude and latitude coordinates of the geographical center of a country based on Googles dataset.

Pygeolocate also allows for developers to search for countries based on their country code (and vice versa) as well as search for partial country names.

Get a country by its full name

# pygeolocate/examples/get_country_by_full_name.py
import pygeolocate

united_kingdom = pygeolocate.locate_by_name("united kingdom")[0]

print(united_kingdom)
print(united_kingdom.name)
print(united_kingdom.coordinates)
print(united_kingdom.coordinates[0])
print(united_kingdom.coordinates['long'])

Get a country by part of its name

# pygeolocate/examples/get_country_by_partial_name.py

import pygeolocate

for country in pygeolocate.locate_by_name("united"):
    print(country)
    print(country.name)
    print(country.coordinates)
    print(country.coordinates[0])
    print(country.coordinates['long'])

About

Get a countries geolocation from its name / country code.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages