Well-Known Locations, or wkls is a Python library designed to help you find geographic boundaries for any location in the world.
wkls is an open-source library maintained by Wherobots that provides easy, programmatic access to global administrative boundaries—countries, regions, cities, and more—using data from the Overture Maps Foundation. It comes pre-installed in WherobotsDB and is also available via pip.With wkls, you can create spatial boundaries for any country, region, or city in the world with a few lines of code and export them in multiple formats.For the latest updates, see the wkls GitHub repository.
wkls replaces the need to find datasets, download large files, and manage complex data pipelines to find geographic boundaries for your areas of interest.For example, the Well-Known Text representation for the geographic boundary of the United States is 3,358,747 characters long!
Inputting that manually would be a nightmare.With wkls, all you have to do is type wkls.us.wkt() to retrieve it.
Don’t believe us? Try it yourself! Run print(str(len(wkls.us.wkt()))) to see the actual character count.
# Get the Well-Known Text (WKT) for the United Statesusa_wkt = wkls.us.wkt()# Get GeoJSON for Californiacalifornia_geojson = wkls.us.ca.geojson()# Get SVG for San Franciscosf_svg = wkls.us.ca.sanfrancisco.svg()
Some countries/dependencies may not have regions, so for those
countries/dependencies you can directly call either .counties() or
.cities(), to further explore the available data.For example, to list all the cities in the Falkland Islands, run the following: