geouk python库为geouk api提供了pythonic接口。
GeoUK的Python项目详细描述
geouk python库
geouk python库为geouk api提供了pythonic接口。它包括一个api客户端类和一组资源类。
安装
pip install geouk
要求
- Python3.7+
用法
importgeoukclient=geouk.Client('your_api_key...')# Get a list of place names and postcodes starting with the query string's# first 2 characters (ideal for use with a typeahead).suggestions=geouk.resources.Place.typeahead(client,'wo...')# Fetch a list of `Place`s that match the given query stringplaces=geouk.resources.Place.search(client,'worcester')print(places[0].humanized_name,places[0].geo_coords)>>Worcester[52.18935,-2.22001]# Fetch all the (data) sourcessources=geouk.resources.Source.all(client)# Fetch a single (data) sourcesource=geouk.resources.Source.one(client,'geonames')