google 基站定位api

google 基站定位api 

说明文档:http://code.google.com/intl/zh-CN/apis/gears/geolocation_network_protocol.html

是post json数据请求到http://www.google.com/loc/json

发送的json数据为

其中 
"request_address" 为是否请求返回地址信息
"address_language" 为 返回的地址信息的语言,我们的是中文 zh_CN
"cell_towers" 便是 基站信息, 可以多添加几个,这样获取到的地址信息比较准确

{
    "version": "1.1.0" ,
    "host": "maps.google.com",
    "home_mobile_country_code": 460,
    "home_mobile_network_code":0,
    "radio_type": "gsm",
    "request_address": True,
    "address_language": "zh_CN",
    "cell_towers":[
        {
            "cell_id":5983,
            "location_area_code":28712,
            "mobile_country_code":460,
            "mobile_network_code":0,
        }
    ]
}
返回的json数据:
"location" 经纬度,
"address"地址,"accuracy"精度
{"location":{"latitude":30.513959,"longitude":114.419156,"address": {"country":"中国","country_code":"CN","region":"湖北省","city":"武汉 市","street":"东三路","street_number":"4 号"},"accuracy":888.0},"access_token":"2:mXZLvtA04kDGg_hZ:F6EP7IcyoXQdatSy"}

#*********************************************************************************************
使用python测试
import simplejson as json
import urllib2
data = {
    "version": "1.1.0" ,
    "host": "maps.google.com",
    "home_mobile_country_code": 460,
    "home_mobile_network_code":0,
    "radio_type": "gsm",
    "request_address": True,
    "address_language": "zh_CN",
    "cell_towers":[
        {
            "cell_id":5983,
            "location_area_code":28712,
            "mobile_country_code":460,
            "mobile_network_code":0,
        }
    ]
}
data_str = json.dumps(data)
fh = urllib2.urlopen(url="http://www.google.com/loc/json", data=data_str)
print fh.read()
原文地址:https://www.cnblogs.com/highfly2012/p/3207600.html