2012-11-17 43 views
4

我試圖使用Google的地理定位「browserlocation」服務。 我想通到目前爲止,當我嘗試像JSON,CURL和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 -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" 
    } 
] 
} 

不知怎的,我知道是不是正確傳輸的文件的內容,但我有NI知道爲什麼......

將不勝感激幫助,謝謝。

+0

看到這個其他stackoverflow文章:http://stackoverflow.com/questions/5063200/firefoxs-geo-wifi-urls-https-www-google-com-loc-json-not-used –

回答

2

你MACADDRESS格式必須

00:14:BF:28:80:69

00-14-BF-28-代替80-69

另外,我覺得你需要添加「年齡」:xx