In these articles, we are going to write python scripts to search a country from a given state or city name and bind it with the GUI application. We will be using the GeoPy module. GeoPy modules make it easier to locate the coordinates of addresses, cities, countries, landmarks, and Zipcode.
Before starting we need to install the GeoPy module, so let’s run to this command on your terminal.
pip install geopy
- Import module
- Use Nominatim API to access the corresponding to set of coordinates
- geocode() to get the location of a given place
The GUI would look like below:
Note: Nominatim uses OpenStreetMap data to find locations on Earth by name and address (geocoding).
Below is the Implementation:
Country Name: Delhi, Kotwali Tehsil, Central Delhi, Delhi, 110006, India
Application for Searching Country from given city/state with Tkinter: This Script implements the above Implementation into a GUI.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.