geolocation 定位可以基于ip, wifi和手机基站,示例是一个基于手机基站定位的例子
请求
POST /loc/json HTTP/1.1
Host: www.google.com
Accept: */*
Content-Type: application/json
Cache-Control: no-cache
Pragma: no-cache
UA-CPU: x86
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)
Proxy-Connection: Keep-Alive
Host: www.google.com
Content-Length: 402
{ "access_token" : "2:bQ-zHwG1xLdiP-sF:3li7KSH1OSqgYn1D", "host" : "code.google.com", "radio_type" : "unknown", "request_address" : true, "version" : "1.1.0", "cell_towers": [
{
"cell_id": "42",
"location_area_code": 415,
"mobile_country_code": 310,
"mobile_network_code": 410,
"age": 0,
"signal_strength": -60,
"timing_advance": 5555
} ] }
响应
HTTP/1.1 200 OK
Content-Type: application/json
Date: Wed, 29 Apr 2009 07:26:28 GMT
Expires: Wed, 29 Apr 2009 07:26:28 GMT
Cache-Control: private, max-age=0
X-Content-Type-Options: nosniff
Content-Length: 262
Server: GFE/2.0
{"location":{"latitude":51.0,"longitude":-0.1,"address":{"country":"United Kingdom","country_code":"GB","region":"West Sussex","county":"Mid Sussex","city":"Haywards Heath","street":"Fairford Close","street_number":"12","postal_code":"RH16 3"},"accuracy":787.0}}
协议详情请参见:
http://code.google.com/apis/gears/geolocation_network_protocol.html