This commit is contained in:
etoai 2025-09-11 15:09:38 +08:00
parent 788b4df64d
commit f6b75d4f8a

View File

@ -15,6 +15,8 @@ DB_CONFIG = {
# 高德地图API配置
AMAP_KEY = "ed2d6b26be983e04db8248adfe01ad24"
jumpnum = 0
def get_location(address):
"""通过高德地图API获取地址的经纬度"""
try:
@ -52,12 +54,18 @@ def update_coordinates():
records = cursor.fetchall()
# 修改获取地址的代码
recordindex = 0
for record in records:
address = record.get('站点地址') # 将 '地址' 改为 '站点地址'
if not address:
print(f"记录中没有地址信息:{record}")
continue
if recordindex < jumpnum:
print(f"跳过地址: {address}")
recordindex += 1
continue
print(f"正在处理地址: {address}")
lng, lat = get_location(address)