Need to install a third-party package: Requests
The latitude and longitude matching using the high-D map API, first of all, the GPS coordinates into the latitude and longitude coordinates of the German map, and then according to the converted coordinates to match.
This match is mainly to get the POI point address information that is closest to a given latitude and longitude.
The main programs are as follows:
1 #-*-coding:utf8-*-2 ImportRequests3 ImportCSV4 ImportChardet5 ImportSYS6 Reload (SYS)7Sys.setdefaultencoding ("UTF8")8 9location='116.81963,40.310799'Ten defGeoCode (location): Oneparameters={' Location': Location,'Key':'7447d3ae24afa6497f1b459fc5cd0419','Extensions':' All'} ABase ='Http://restapi.amap.com/v3/geocode/regeo' -Response =requests.get (base,parameters) -Answer =Response.json () the Printanswer['Regeocode']['POIs'][0]['name'] - - defTransform (location): -Parameters = {'Locations': Location,'Coordsys':'GPS','Key':'7447d3ae24afa6497f1b459fc5cd0419'} +Base ='Http://restapi.amap.com/v3/assistant/coordinate/convert' -Response =requests.get (base,parameters) +Answer =Response.json () A returnanswer['Locations'] at - -GeoCode (transform (location))
The results of the operation are as follows:
If you need to get additional address information to output other values in the corresponding answer, the name of the value corresponds to the following:
Python application: Latitude-matched