Advanced Interface - Get user location

Official Documents

ON:

 

Converting coordinates to the address: WGS-84, GCJ-02 (Tencent map, Google map of China), Baidu coordinate system. (Baidu Maps supports the WGS-84, GCJ-02 converted into Baidu coordinate functions) 

When the micro-channel public number acquired after the user location coordinates, to the coordinates of the real need to convert the location of the user, so that more intuitive understanding of the user as well as data analysis

Baidu map GeocodingAPI provide inverse address resolution function, that address information is obtained by the latitude and longitude information. When we reverse address resolution, we need to pay attention to select the correct type of coordinates.

http://api.map.baidu.com/lbsapi/cloud/geocoding-api.htm#.E6.9C.8D.E5.8A.A1.E5.9C.B0.E5.9D.80

ak='QGeUGqrqWwHNSMWC0QOHixE4DGvH7AH0'
url ='http://api.map.baidu.com/reverse_geocoding/v3/?ak={0}&location={1},{2}&output=json&coordtype=gcj0211'.format(
    if, 30.995832,121.440086
)
url='http://api.map.baidu.com/geocoder?location=30.995832,121.440086&output=json&key=QGeUGqrqWwHNSMWC0QOHixE4DGvH7AH0'
response = requests.get(url)
response_dic = json.loads(response.text,'utf-8')

Guess you like

Origin www.cnblogs.com/ahMay/p/12072468.html