利用tac+cellid值,调用LBS数据仓库api返回基站的经纬度和地址
代码:
from urllib import request
import json
lac=int(line.TAC)
ci=int(line.Cell_id)
url='http://api.cellocation.com:81/cell/?cell/?mcc=460&mnc=0&lac='+str(lac)+'&ci='+str(ci)+'&output=json'
with request.urlopen(url) as f:
data=f.read()
s=json.loads(data.decode('utf-8'))
if s.get("errcode")==0:
lat=s.get("lat")
lon=s.get("lon")
address=s.get("address")
result="{0},{1},{2}".format(lon,lat,address)
return result
else:return