Baidu¶
Baidu Maps Geocoding API is a free open the API, the default quota one million times / day.
Geocoding¶
>>> import geocoder # pip install geocoder
>>> g = geocoder.baidu('中国', key='<API KEY>')
>>> g.json
...
Reverse Geocoding¶
>>> import geocoder
>>> latlng = [45.3, -105.1]
>>> g = geocoder.baidu(latlng, method='reverse', key='<API KEY>')
>>> g.json
...
Command Line Interface¶
$ geocode '中国' --provider baidu
Environment Variables¶
To make sure your API key is store safely on your computer, you can define that API key using your system’s environment variables.
$ export BAIDU_API_KEY=<Secret API Key>
$ export BAIDU_SECURITY_KEY=<Secret API Security Key>
Parameters¶
- location: Your search location you want geocoded.
- key: Baidu API key.
- sk: Baidu API security key. Use with key. For Baidu developers.
- method: (default=geocode) Use the following:
- geocode
- reverse