一.官方文档
https://github.com/geopy/geopy
二.模块安装
pip3 install geopy
三.简单实用
复制from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.90 Safari/537.36")
location = geolocator.geocode("喜马拉雅山")
print(location.address)
print(location.latitude)
print(location.longitude)
print(location.altitude)
print(location.point)
print(location.raw)
----------------------------打印内容-------------------------自己分析你想要的-----------------------
歇马, 夹江县, 乐山市, 四川省, China 中国
0.0
29.7829883
103.3762716
29 46m 58.7579s N, 103 22m 34.5778s E
{'place_id': 283863800, 'licence': 'Data © OpenStreetMap contributors, ODbL 1.0. https://osm.org/copyright', 'osm_type': 'node', 'osm_id': 7406082604, 'boundingbox': ['29.7629883', '29.8029883', '103.3562716', '103.3962716'], 'lat': '29.7829883', 'lon': '103.3762716', 'display_name': '歇马, 夹江县, 乐山市, 四川省, China 中国', 'class': 'place', 'type': 'suburb', 'importance': 0.24110736422489376, 'icon': 'https://nominatim.openstreetmap.org/images/mapicons/poi_place_village.p.20.png'}
出处:https://www.cnblogs.com/pythonywy/p/13627542.html