Recently, I want to do something about the map. I simply read a few maps and found that Baidu maps are still good. Google maps are not charged. mapabc and mapbar only provide client interfaces. What is falsh? JavaScript, it seems that only Baidu map has a server interface.
Paste a demo written in Python :(
# Coding = UTF-8 Import Urllib Import Urllib2map_api_url = ' Http://api.map.baidu.com/geocoder/v2? ' AK = ' 38dbc1cdbb8170d3f08a4db1_de55d2 ' # Address Resolution Def Geocoder (address, city = ' Beijing ' ): Query_args = { ' Address ' : Address, ' City ' : City, ' Output ' : ' XML ' , ' AK ' : AK} encoded_args = Urllib. urlencode (query_args) render_url (map_api_url + Encoded_args) # Reverse Address Resolution Def Geodecoder (Lat, LNG, pois = 0): Location = " % F, % F " % (Lat, LNG) Output = ' XML ' Query_args = ' Location = % S & aK = % S & Output = % S & pois = % d ' %\ (Location, AK, output, pois) render_url (map_api_url + Query_args) Def Render_url (URL): Response = Urllib2.urlopen (URL) headers = Response.info () data = Response. Read () response. Close () show_response (headers, data) Return Data Def Show_response (headers, data ): Print ' Headers: ' Print ' ---------- ' Print Headers Print ' Data: ' Print ' ---------- ' Print Data. Decode ( ' UTF-8 ' ) If _ Name __ = ' _ Main __ ' : Geocoder ( ' Orange continent ' , ' Changsha City ' ) Lat = 28.175617295411 LNG = 112.96695042246 Geodecoder (Lat, LNG, 1)