根据wifi aps和radiocells.org或mozilla位置数据库获取位置。
wifindme的Python项目详细描述
使用附近的接入点定位当前启用WiFi的计算机,并 https://radiocells.org/geolocation或 https://wiki.mozilla.org/CloudServices/Location/FAQ 或者两者都有。
项目主页:https://github.com/ways/wifindme
从https://github.com/ways/locate-radiocells接管,增加了mozilla定位服务的好处。
安装
$ pip install wifindme
用法
必须以根用户身份运行才能访问Linux上的扫描。
示例使用:
importwifindmeaccuracy,latlng=wifindme.locate(device='wlan0')
examples/,(以米和坐标为单位打印精度)中包含的示例脚本:
$ sudo ./wifindme.py wlan0 30(59.12345, 10.12345)
兼容性
Python2和3。只在linux上测试过(ubuntu,fedora,arch)。
开发信息
发送到radiocells.org的查询示例:
curl-H"Accept: application/json"-H"Content-type: application/json"-XPOST-d'{"wifiAccessPoints":[{"macAddress":"24-DE-C6-A8-C9-64","signalStrength":-57}]}'https://radiocells.org/backend/geolocate
示例响应:
{"source":"wifis","measurements":14,"location":{"lat":59.12345,"lng":10.12345},"accuracy":30}
或失败时:
{'resultType':'error','results':{'source':'none','measurements':0,'location':{'lat':0.0,'lng':0.0},'accuracy':9999},'error':{'message':'Emptyrequest','code':400,'errors':[{'message':None,'reason':'parseError','domain':'global'}]}}
待办事项
- 通知https://wiki.mozilla.org/CloudServices/Location/Software
- 支持同时从两者获取位置。
- googles api是兼容的,所以也可以添加它。
- 如果可以用测试api密钥打包,请与mozilla联系。
- 纠正放射细胞的“准确性”。他们总是给3千万…