python坐标获取经纬度或经纬度获取坐标免费模块geopy
一.官方文档
python">https://github.com/geopy/geopy
二.模块安装
pip3 install geopy
三.简单实用
from geopy.geocoders import Nominatimgeolocator = 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") #放ua
location = geolocator.geocode("喜马拉雅山") #根据查相关信息
#location = geolocator.reverse("52.509669, 13.376294") #根据坐标查
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"}
以上是 python坐标获取经纬度或经纬度获取坐标免费模块geopy 的全部内容, 来源链接: utcz.com/z/531186.html