我正在尝试使用Google的地理定位"浏览器位置"服务。到目前为止,我已经想通了,当我尝试类似的东西时
https://maps.googleapis.com/maps/api/browserlocation/json?browser=firefox&sensor=true&
wifi=mac:00-14-bf-28-80-69|ssid:10160|ss:-26&
wifi=mac:00-26-50-38-ca-11|ssid:2WIRE084|ss:-69&
wifi=mac:34-ef-44-7c-0e-b1|ssid:2WIRE202|ss:-70&
wifi=mac:00-1f-b3-64-b3-f1|ssid:2WIRE605|ss:-74&
wifi=mac:00-26-50-e3-1f-81|ssid:2WIRE137|ss:-79&
wifi=mac:00-1d-5a-ef-4d-b9|ssid:2WIRE495|ss:-81&
wifi=mac:c0-83-0a-69-c4-b9|ssid:2WIRE431|ss:-81&
wifi=mac:30-46-9a-43-3d-71|ssid:MacAdamN|ss:-84&
wifi=mac:64-0f-28-bf-e2-91|ssid:2WIRE552|ss:-86&
wifi=mac:00-14-d1-cd-a4-88|ssid:TRENDnet637|ss:-86&
wifi=mac:00-23-5e-b0-70-90|ssid:AppleWiFi|ss:-86&
wifi=mac:00-23-5e-af-39-a0|ssid:AppleWiFi|ss:-86&
wifi=mac:00-1d-d1-55-0d-90|ssid:HOME-0D92|ss:-88
在浏览器中,我得到了相当准确的结果,请自己检查一下。但是当我想使用 JSON 文件使用 curl 传递数据时,例如
curl -i -X POST -d @ssids.json "https://maps.googleapis.com/maps/api/browserlocation/json?browser=firefox&sensor=true"
我得到了可怕的准确性("准确性":18000.0,)。文件 ssids.json 的内容如下所示:
{
"wifi_access_points": [
{
"macAddress": "00-14-bf-28-80-69",
"signalStrength": "-26"
},
{
"macAddress": "00-26-50-38-ca-11",
"signalStrength": "-69"
},
{
"macAddress": "00-26-50-38-ca-11",
"signalStrength": "-69"
},
{
"macAddress": "34-ef-44-7c-0e-b1",
"signalStrength": "-70"
},
{
"macAddress": "00-1f-b3-64-b3-f1",
"signalStrength": "-74"
},
{
"macAddress": "00-26-50-e3-1f-81",
"signalStrength": "-79"
},
{
"macAddress": "00-1d-5a-ef-4d-b9",
"signalStrength": "-81"
},
{
"macAddress": "c0-83-0a-69-c4-b9",
"signalStrength": "-81"
},
{
"macAddress": "30-46-9a-43-3d-71",
"signalStrength": "-84"
},
{
"macAddress": "64-0f-28-bf-e2-91",
"signalStrength": "-86"
},
{
"macAddress": "00-14-d1-cd-a4-88",
"signalStrength": "-86"
},
{
"macAddress": "00-23-5e-b0-70-90",
"signalStrength": "-86"
},
{
"macAddress": "00-23-5e-af-39-a0",
"signalStrength": "-86"
},
{
"macAddress": "00-1d-d1-55-0d-90",
"signalStrength": "-88"
}
]
}
不知何故,我知道文件的内容未正确传输,但我知道为什么......
将不胜感激,谢谢。
您的 macAddress 格式需要
00:14:BF:28:80:69
而不是这个
00-14-BF-28-80-69
另外,我认为您需要添加"年龄":xx