[三]基于网页/URL的地图点标记
def heml_map(loaction: str):
url_a = 'https://m.amap.com/navi/?dest='
url_b = '&destName='
url_c = '您自定义的位置名称'
url_d = '&hideRouteIcon=1&key=a0151d367ff494823a0ad4d4bd78bb0f'
url = url_a + loaction + url_b + url_c + url_d
webbrowser.open(url)
def URL_mask():
Num = int(input('请输入您添加的地址个数,但别超过20个: '))
if Num > 20:
print("Too Many Address You Add !!!!!!!!!")
else:
City = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
Address = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
Name = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
Coordinate = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
i = 0
for i in range(0,Num):
Name[i],Address[i],City[i] = input('输入地址意义,地址,城市(中文逗号):(如:开会地点,五里河公园,沈阳)\n').split(',')
Coordinate[i] = geo(Address[i],City[i])
url_a = 'https://ditu.amap.com/marker?markers='
i = 0
url_b = ''
for i in range(0,Num):
url_b = url_b + Coordinate[i] + dot + Name[i] + line
url_c = '&src=mypage&callnative=0'
URL = url_a + url_b + url_c
print('%s'%(URL))
webbrowser.open(URL)
效果如图: