{"id":445,"date":"2009-11-28T05:12:00","date_gmt":"2009-11-27T13:12:00","guid":{"rendered":"http:\/\/blog.newnaw.com\/?p=445"},"modified":"2009-11-28T05:12:00","modified_gmt":"2009-11-27T13:12:00","slug":"python%e9%ad%85%e5%8a%9b%e4%b9%8b%e5%9c%b0%e7%90%86%e6%95%b0%e6%8d%ae%e5%bf%ab%e9%80%9f%e5%a4%84%e7%90%86%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/blog.newnaw.com\/?p=445","title":{"rendered":"Python\u9b45\u529b\u4e4b\u5730\u7406\u6570\u636e\u5feb\u901f\u5904\u7406\u65b9\u6cd5"},"content":{"rendered":"<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Python\u4f5c\u4e3a\u4e00\u79cd\u6210\u719f\u7684\u811a\u672c\u8bed\u8a00\uff0c\u53d1\u5c55\u52bf\u5934\u8fc5\u731b\uff0c\u957f\u671f\u5f98\u5f8a\u5728\u201c<a href=\"http:\/\/www.tiobe.com\/index.php\/content\/paperinfo\/tpci\/index.html\">\u7f16\u7a0b\u8bed\u8a00\u8c31<\/a>\u201d\u6392\u884c\u524d5\u7684\u4f4d\u7f6e\uff0c\u5728\u811a\u672c\u8bed\u8a00\u4e2d\u4ec5\u6b21\u4e8ephp\u3002\u901a\u8fc7Python\uff0c\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u5feb\u901f\u8bd5\u9a8c\u4e00\u4e2a\u60f3\u6cd5\u3001\u7814\u7a76\u4e00\u79cd\u5bf9\u8c61\u5c5e\u6027\u6216\u4e0d\u540c\u7b97\u6cd5\uff0c\u800c\u65e0\u9700\u7f16\u8bd1\u3001\u6267\u884c\u548c\u6d4b\u8bd5\u4efb\u4f55\u4ee3\u7801\u3002\u6b63\u662f\u56e0\u4e3a\u8de8\u5e73\u53f0\u3001\u7b80\u6d01\u3001\u4f18\u7f8e\u7684\u7279\u70b9\uff0c\u5b83\u4e5f\u5982\u540cGIS\u5e94\u7528\u6e17\u900f\u4e8e\u5404\u5404\u4e2a\u884c\u4e1a\u4e00\u6837\uff0c\u6e17\u900f\u5728\u79d1\u5b66\u8ba1\u7b97\u7684\u5404\u4e2a\u9886\u57df\u3002\u5728GIS\u9886\u57df\uff0c\u51e0\u4e4e\u53ef\u4ee5\u8bf4\u5f00\u6e90\u8a00\u5fc5\u79f0Python\uff1b\u800cArcGIS\u5219\u5c06Python\u79f0\u4e3athe scientific programming language for GIS\uff1aArcGIS Server\u7684\u731b\u5c06Geoprocessing Service\u4f9d\u8d56\u4e8ePython\uff0c\u4ece9.4\u5c06Python IDE\u96c6\u6210\u5230ArcMap\u4e2d\u4e5f\u53ef\u89c1\u4e00\u6591\u3002<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u524d\u4e00\u9635<a href=\"http:\/\/www.cnblogs.com\/flyingis\/archive\/2009\/11\/05\/1596472.html\">Flyingis\u8d34\u51fa\u4e86\u4e00\u7bc7\u7c7b\u4f3c\u7684\u6587\u7ae0<\/a>\uff0c\u4e0d\u8fc7\u8fd8\u662f\u901a\u8fc7\u52a8\u624b\u5b8c\u6210\u4e00\u4e2a\u5b9e\u4f8b\uff0c\u6765\u770b\u770b\u5b83\u5728ArcMap\u4e2d\u7684\u6570\u636e\u5feb\u901f\u5904\u7406\u80fd\u529b\u5427\u3002\u63cf\u8ff0\uff1a\u4e0a\u4f20\u5230<a href=\"http:\/\/www.panoramio.com\/help\/\">Panoramio<\/a>\u7684\u7167\u7247\u90fd\u4f1a\u6709\u4f4d\u7f6e\u4fe1\u606f\uff08\u7ecf\u7eac\u5ea6\u5750\u6807\uff09\uff0c\u6709\u4e9b\u670b\u53cb\u975e\u5e38\u53ef\u656c\uff0c\u4e0a\u4f20\u7684\u7167\u7247\u6570\u91cf\u53ef\u8fbe\u4e0a\u4e07\u5f20\u3002\u5206\u6790\u4e00\u4e0b\u67d0\u4e2a\u7528\u6237\u62cd\u7167\u7684\u6d3b\u52a8\u8303\u56f4\uff0c\u662f\u4ef6\u6709\u8da3\u548c\u6709\u610f\u4e49\u7684\u4e8b\u60c5\u3002\u601d\u8def\uff1a1\u3001\u5229\u7528<a href=\"http:\/\/www.panoramio.com\/api\">Panoramio\u7684API<\/a>\uff0c\u83b7\u53d6\u6307\u5b9a\u7528\u6237\u7684\u6240\u6709\u7167\u7247\u4fe1\u606f\uff1b2\u3001\u5c06\u5173\u5fc3\u7684\u4fe1\u606f\uff0c\u6bd4\u5982\u4f5c\u8005\u3001\u7167\u7247\u540d\u79f0\u3001\u7167\u7247\u6587\u4ef6\u94fe\u63a5\u63d0\u53d6\u51fa\u6765\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5230\u5730\u7406\u6570\u636e\u5e93\u4e2d\u3002<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u7b2c\u4e00\u6b65\uff1a\u83b7\u53d6\u7167\u7247\u4fe1\u606f\u3002\u5148\u770b\u4e00\u4e0bPanoramio\u7684API\uff0cREST\u98ce\u683c\uff0c\u8fd4\u56deJSON\u5b57\u7b26\u4e32\u3002\u6bd4\u5982\u901a\u8fc7<a href=\"http:\/\/www.panoramio.com\/map\/get_panoramas.php?order=popularity&#038;set=public&#038;from=0&#038;to=20&#038;minx=-180&#038;miny=-90&#038;maxx=180&#038;maxy=90&#038;size=medium\">http:\/\/www.panoramio.com\/map\/get_panoramas.php?order=popularity&#038;set=public&#038;from=0&#038;to=20&#038;minx=-180&#038;miny=-90&#038;maxx=180&#038;maxy=90&#038;size=medium<\/a>\uff0c\u5373\u53ef\u6309\u70b9\u51fb\u6b21\u6570\u6392\u5e8f\u83b7\u5f97\u4e16\u754c\u8303\u56f4\u5185\u6240\u6709\u53d7\u6b22\u8fce\u7684\u7167\u7247\u3002<br \/><code><br \/>{<br \/>      \"count\": 773840,\"photos\": [<br \/>        {<br \/>          \"photo_id\": 532693,<br \/>          \"photo_title\": \"Wheatfield in afternoon light\",<br \/>          \"photo_url\": \"http:\/\/www.panoramio.com\/photo\/532693\",<br \/>          \"photo_file_url\": \"http:\/\/static2.bareka.com\/photos\/medium\/532693.jpg\",<br \/>          \"longitude\": 11.280727,<br \/>          \"latitude\": 59.643198,<br \/>          \"width\": 500,<br \/>          \"height\": 333,<br \/>          \"upload_date\": \"22 January 2007\",<br \/>          \"owner_id\": 39160,<br \/>          \"owner_name\": \"Snemann\",<br \/>          \"owner_url\": \"http:\/\/www.panoramio.com\/user\/39160\",<br \/>        },<br \/>        {<br \/>          \"photo_id\": 505229,<br \/>          \"photo_title\": \"Etangs pr\u00e8s de Dijon\",<br \/>          \"photo_url\": \"http:\/\/www.panoramio.com\/photo\/505229\",<br \/>          \"photo_file_url\": \"http:\/\/static2.bareka.com\/photos\/medium\/505229.jpg\",<br \/>          \"longitude\": 5.168552,<br \/>          \"latitude\": 47.312642,<br \/>          \"width\": 350,<br \/>          \"height\": 500,<br \/>          \"upload_date\": \"20 January 2007\",<br \/>          \"owner_id\": 78506,<br \/>          \"owner_name\": \"Philippe Stoop\",<br \/>          \"owner_url\": \"http:\/\/www.panoramio.com\/user\/78506\"<br \/>        }, ...<br \/>      ]<br \/>    }<\/p>\n<p><\/code><br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Panoramio\u6587\u6863\u8bf4\u6709773840\u5f20\uff0c\u4f46\u662fJSON\u91cc\u7684count\u53ea\u6709338\u5f20\uff0c\u641c\u5176\u8bba\u575b\uff0c\u53d1\u73b0\u8fd9\u662f<a href=\"http:\/\/www.panoramio.com\/forum\/viewtopic.php?p=258674&#038;sid=2e8e22286832c9477e0e1aba730f7feb 42563,50078g\">\u4e00\u4e2abug<\/a>\u3002\u5f53\u7136\uff0c\u4e3a\u4e86\u5b89\u5168\u8d77\u89c1\uff0c\u4e00\u6b21\u8bf7\u6c42\u6700\u591a\u53ea\u80fd\u8fd4\u56de100\u5f20\u7167\u7247\u7684\u4fe1\u606f\uff0cPython\u521a\u597d\u6765\u5b8c\u6210\u82e5\u5e72\u4e2a\u201c100\u201d\u7684\u62fc\u88c5\u4efb\u52a1\u3002\u4ee3\u7801\u5982\u4e0b\uff1a<br \/><code><br \/>import arcgisscripting,json,urllib,os,threading<br \/>lphotos=[]#list saves all photo json objects<br \/>lock=threading.Lock()<\/p>\n<p>#function to construct the panoramio request url and retrieve the corresponding photos as json array<br \/>#for eg: http:\/\/www.panoramio.com\/map\/get_panoramas.php?order=upload_date&set=139922&from=0&to=20&minx=108.355671725&miny=33.807692976&maxx=109.475020647&maxy=34.732003828&size=medium<br \/>#set:  public (popular photos); full (all photos); user ID number<br \/>#size:     original; medium (default value) ;small ; thumbnail ;  square ; mini_square<br \/>def retrievephotos(set,fromindex,toindex,size):<br \/>    global lphotos,gp<br \/>    #extent=r\"&minx=108.355671725&miny=33.807692976&maxx=109.475020647&maxy=34.732003828\"<br \/>    extent=r\"&minx=-180&miny=-90&maxx=180&maxy=90\"<br \/>    url=r\"http:\/\/www.panoramio.com\/map\/get_panoramas.php?order=upload_date&set=\"+set+\"&from=\"+str(fromindex)+\"&to=\"+str(toindex)+extent+\"&size=\"+size<br \/>    try:<br \/>        jsonresult=json.read(urllib.urlopen(url).read())<br \/>    except:<br \/>        raise Exception,\"get panoramio result error\"<br \/>    photos=jsonresult[\"photos\"]<br \/>    if len(photos)&lt;toindex-fromindex:<br \/>        print \"warning: can't get photos from server \"+str(fromindex)+\"--\"+str(toindex)<br \/>        #gp.addwarning(\"warning: can't get photos from server \"+str(fromindex)+\"--\"+str(toindex))#typeerror:'no type' object is not callable<br \/>    else:<br \/>        for photo in photos:<br \/>            lock.acquire()<br \/>            lphotos.append(photo)<br \/>            lock.release()<br \/>    return jsonresult[\"count\"]#the total of photos of the specified set<\/p>\n<p>#use multithread to retrieve photos, the number of threads=(end-start)\/100<br \/>#start: 0 in usual<br \/>#end: the total of photos<br \/>def getphotolist(set,start,end,size):<br \/>    list=[start]<br \/>    while list[-1]&lt;end:<br \/>        list.append(list[-1]+100)<br \/>    threads=[]<br \/>    gp.addmessage(str(len(list))+\" threads has launched...\")<br \/>    for i in list:<br \/>        threads.append(threading.Thread(target=retrievephotos,args=(set,i,i+100,size),name=str(i)))<br \/>    for t in threads:<br \/>        t.start()<br \/>    for t in threads:<br \/>        t.join()#suspend the parent(main) thread until this thread is over<br \/><\/code><br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u5728\u8fd0\u884c\u8fc7\u7a0b\u4e2d\uff0c\u53d1\u9001\u8bf7\u6c42\uff08\u8bf7\u6c42100\u5f20\u7167\u7247\u7684\u4fe1\u606f\uff09\u540e\u7b49\u5f85\u670d\u52a1\u5668\u54cd\u5e94\u4f1a\u82b1\u8d39\u4e00\u4e9b\u65f6\u95f4\uff0c\u4e8e\u662f\u5c31\u91c7\u7528Python\u4e2d\u7684\u591a\u7ebf\u7a0b\uff0c\u6765\u540c\u65f6\u53d1\u9001\u591a\u4e2a\u8bf7\u6c42\u3002Threading\u662fPython\u7684\u4e00\u4e2a\u6807\u51c6\u6a21\u5757\uff0c\u9ebb\u96c0\u867d\u5c0f\uff0c\u4e94\u810f\u4ff1\u5168\u3002\u5355\u7ebf\u7a0b\u8bf7\u6c42\u65f6\uff0c5000\u5f20\u7167\u7247\u7684\u7ed3\u679c\u5927\u7ea6\u9700\u89818\u5206\u591a\u949f\uff0c\u591a\u7ebf\u7a0b\u8bf7\u6c42\u65f6\u9700\u8981\u53ea\u9700\u898140\u591a\u79d2\u5373\u53ef\u3002\u8bf7\u6c42\u5168\u90e8\u88ab\u76f8\u5e94\u540e\uff0c\u5373\u5b8c\u6210\u4e86\u6240\u6709\u7167\u7247\u4fe1\u606f\u7684\u62fc\u88c5\u5de5\u4f5c\uff1a\u7ed3\u679c\u5b58\u50a8\u5728\u7c7b\u578b\u4e3aList\u7684lphotos\u53d8\u91cf\u4e2d\u3002List\u662fPython\u4e2d\u4f7f\u7528\u6700\u5e7f\u6cdb\u7684\u53d8\u91cf\u4e4b\u4e00\uff0c\u7075\u6d3b\u597d\u7528\uff0c\u4e00\u4e2a\u98765\u4e2a~\u4e0d\u8fc7\u8fd9\u91cc\u6709\u4e2a\u95ee\u9898\u6ca1\u6709\u89e3\u51b3\uff1a\u5728\u5b50\u7ebf\u7a0b\u7684\u51fd\u6570\u4e2d\uff0c\u8c03\u7528geoprocessor\u7684addmessage()\u65b9\u6cd5\u4f1a\u62a5\u9519\uff08\u4ee3\u7801\u4e2d\u6ce8\u91ca\u6389\u7684\u4e00\u53e5\uff09\uff0c\u975e\u76ee\u524d\u80fd\u529b\u6240\u80fd\u89e3\u51b3\u3002<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u9898\u5916\u8bdd\uff1a\u4e0a\u8ff0\u591a\u7ebf\u7a0b\u7684\u5de5\u4f5c\u4e5f\u53ef\u4ee5\u7528\u5e76\u884c\u8ba1\u7b97\u6765\u89e3\u51b3\uff0c\u8fd9\u91cc\u6709<a href=\"http:\/\/www.cnblogs.com\/flyingis\/archive\/2009\/11\/12\/1601574.html\">\u4e00\u7bc7\u51fa\u81eaFlyingis\u7684\u5173\u4e8ePython\u4e2d\u5e76\u884c\u8ba1\u7b97\u7684\u6587\u7ae0<\/a>\uff0c\u4f9b\u5927\u5bb6\u5b66\u4e60\u3002\u968f\u7740\u591a\u6838CPU\u7684\u666e\u53ca\uff08ps\uff1a<a href=\"http:\/\/tech.sina.com.cn\/it\/2009-11-28\/02543632224.shtml\">\u7845\u8c37\u5c0f\u516c\u53f8\u63a8\u51fa100\u6838CPU \u6027\u80fd\u662f\u82f1\u7279\u5c14\u56db\u500d<\/a>\uff09\uff0c\u5e76\u884c\u8ba1\u7b97\u5c06\u4f1a\u6210\u4e3a\u5f00\u53d1\u4eba\u5458\u7684\u65b0\u5ba0\uff0c<a href=\"http:\/\/blog.csdn.net\/bitfan\/category\/579281.aspx\">\u5fae\u8f6f.NET Framework 4.0\u4e2d\u7684Parallel Extention<\/a>\u4e5f\u8bf4\u660e\u4e86\u8fd9\u4e00\u70b9\u3002\u81f3\u4e8e\u5e76\u884c\u8ba1\u7b97\u548c\u591a\u7ebf\u7a0b\u4e4b\u95f4\u7684\u533a\u522b\uff0c\u63f4\u5f15\u79d1\u73ed\u51fa\u8eab\u7684\u540c\u5b66\u80d6\u80d6\u9f20\u7684\u8bdd\uff1a<\/p>\n<blockquote><p>\u4e24\u8005\u9488\u5bf9\u6027\u4e0d\u540c\u3002\u591a\u7ebf\u7a0b\u6280\u672f\u662f\u64cd\u4f5c\u7cfb\u7edf\u4e2d\u7684\u6982\u5ff5\uff0c\u662f\u8f6f\u4ef6\u7684\u6982\u5ff5\u3002\u6307\u8fdb\u7a0b\u4e2d\u7684\u4e00\u90e8\u5206\u3002\u4ee5\u524d\u5e76\u884c\u8ba1\u7b97\u4e3b\u8981\u66f4\u4fa7\u91cd\u786c\u4ef6CPU\uff0c\u73b0\u5728\u6cdb\u6307\u540c\u65f6\u4f7f\u7528\u591a\u4e2a\u8ba1\u7b97\u8d44\u6e90\u89e3\u51b3\u95ee\u9898\u3002\u6211\u611f\u89c9\u4e24\u8005\u90fd\u7528\u5230\u4e86\u5e76\u53d1\u6027\u5e76\u884c\u6027\u7684\u6982\u5ff5\u3002<\/p><\/blockquote>\n<p>\u4e2a\u4eba\u611f\u89c9\u53ef\u7b80\u5355\u7406\u89e3\u4e3a\uff0c\u5e76\u884c\u8ba1\u7b97\u662f\u5bf9\u7ec6\u679d\u672b\u8282\u7684\u591a\u7ebf\u7a0b\u6280\u672f\u66f4\u4f18\u7684\u62bd\u8c61\uff0c\u4e0e\u4e00\u4e2aCPU\u91cc\u7684\u591a\u7ebf\u7a0b\u4e0d\u540c\uff0c\u5b83\u80fd\u5229\u7528\u591a\u4e2aCPU\uff08\u4e0d\u540c\u670d\u52a1\u5668\uff09\u8d44\u6e90\uff0c\u56de\u5f52\u5230\u7f51\u683c\u8ba1\u7b97\u7684\u6982\u5ff5\u3002\u4e0b\u9762\u7ee7\u7eed\u4e3b\u9898\u3002<br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u7b2c\u4e8c\u6b65\uff1a\u4fdd\u5b58\u6570\u636e\u3002\u4e4b\u540e\u6211\u4eec\u4fbf\u53ef\u4ee5\u5229\u7528geoprocessor\u5b8c\u6210\u6570\u636e\u5904\u7406\u5de5\u4f5c\u3002\u9996\u5148\u901a\u8fc7\u8c03\u7528Toolbox\u4e2d\u7684\u5de5\u5177\u521b\u5efa\u5b58\u50a8\u6570\u636e\u7684FeatureClass\uff0c\u5e76\u8c03\u7528\u5de5\u5177\u6dfb\u52a0\u76f8\u5e94\u7684\u5b57\u6bb5\uff1a<br \/><code><br \/>#create the 9.3 geoprocessor<br \/>gp=arcgisscripting.create(9.3)<br \/>gp.OverwriteOutput=True<br \/>myuserid=gp.getparameterastext(0)#\"305320\"<br \/>gp.Workspace=gp.getparameterastext(1)<br \/>myfile=os.path.basename(gp.getparameterastext(2))<\/p>\n<p>#create 2 result featureclasses<br \/>try:<br \/>    gp.addmessage(\"creating featureclasses...\")<br \/>    sr=gp.CreateObject(\"SpatialReference\")<br \/>    sr.Createfromfile(r\"E:Program FilesArcGISCoordinate SystemsGeographic Coordinate SystemsWorldWGS 1984.prj\")<br \/>    gp.Createfeatureclass(gp.workspace,myfile,\"POINT\",\"\",\"\",\"\",sr)<br \/>    gp.Addfield(myfile,\"owner\",\"TEXT\",\"\",\"\",100)<br \/>    gp.Addfield(myfile,\"title\",\"TEXT\",\"\",\"\",100)<br \/>    gp.Addfield(myfile,\"photourl\",\"TEXT\",\"\",\"\",150)<br \/>    #gp.Createfeatureclass(gp.workspace,xafile,\"POINT\",myfile,\"\",\"\",sr)<br \/>    del sr<br \/>except:<br \/>    gp.adderror(\"creating featureclasses error\")<br \/>    raise Exception,\"creating featureclasses error\"<\/p>\n<p>#push the photos into the featureclass<br \/>gp.addmessage(\"dealing my photos\")<br \/>dealphotos(myuserid,myfile)<br \/><\/code><br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u6700\u540e\u4e24\u53e5\u4fbf\u662f\u6574\u4e2a\u529f\u80fd\u7684\u5165\u53e3\u70b9\u4e86\u3002dealphotos\u51fd\u6570\u5982\u4e0b\uff1a<br \/><code><br \/>#function to push photos into featureclass<br \/>def dealphotos(set,fc):<br \/>    photoscount=retrievephotos(set,0,1,\"medium\")<br \/>    gp.addmessage(\"start to retrieving photos...\")<br \/>    getphotolist(set,0,photoscount,\"medium\")<br \/>    gp.addmessage(\"retrieving photos completed\")<br \/>    cur=gp.InsertCursor(fc)<br \/>    descfc=gp.Describe(fc)<br \/>    print \"begin insert features...\"<br \/>    gp.addmessage(\"begin insert features...\")<br \/>    for photo in lphotos:<br \/>        row=cur.NewRow()<br \/>        pnt=gp.CreateObject(\"POINT\")<br \/>        pnt.x=photo[\"longitude\"]<br \/>        pnt.y=photo[\"latitude\"]<br \/>        row.Setvalue(descfc.shapefieldname,pnt)<br \/>        row.Setvalue(\"owner\",photo[\"owner_name\"])<br \/>        row.Setvalue(\"title\",photo[\"photo_title\"])http:\/\/www.blogger.com\/post-edit.g?blogID=21848155&postID=4114083803361112294#<br \/>        row.Setvalue(\"photourl\",photo[\"photo_file_url\"])<br \/>        cur.InsertRow(row)<br \/>    print \"insert features completed\"<br \/>    gp.addmessage(\"insert features completed\")  <br \/>    del cur,descfc<br \/><\/code><br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u597d\u5566\uff0cPython\u90e8\u5206\u7ed3\u675f\uff0c\u6dfb\u52a0\u5230ArcMap\u4e2d\uff0c\u4fbf\u53ef\u6210\u4e3a\u4e00\u4e2aScript Tool\uff0c\u4e0e\u4ed6\u4eba\u5206\u4eab\u4e86\u3002\u8fd0\u884c\u754c\u9762\uff1a<br \/><a onblur=\"try {parent.deselectBloggerImageGracefully();} catch(e) {}\" href=\"http:\/\/3.bp.blogspot.com\/_DD8LUY9p6iU\/SxEhDQzOX0I\/AAAAAAAAAXw\/xBLnWNseFEY\/s1600\/ScriptToolsavephotos.jpg\"><img decoding=\"async\" style=\"display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 308px;\" src=\"http:\/\/3.bp.blogspot.com\/_DD8LUY9p6iU\/SxEhDQzOX0I\/AAAAAAAAAXw\/xBLnWNseFEY\/s400\/ScriptToolsavephotos.jpg\" border=\"0\" alt=\"\"id=\"BLOGGER_PHOTO_ID_5409140967381819202\" \/><\/a><br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u8fd0\u884c\u7ed3\u679c\uff1a<br \/><a onblur=\"try {parent.deselectBloggerImageGracefully();} catch(e) {}\" href=\"http:\/\/1.bp.blogspot.com\/_DD8LUY9p6iU\/SxEi4tHD2II\/AAAAAAAAAX4\/sQ2_7-OYWCw\/s1600\/ScriptToolsavephotosresult.jpg\"><img decoding=\"async\" style=\"display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 400px;\" src=\"http:\/\/1.bp.blogspot.com\/_DD8LUY9p6iU\/SxEi4tHD2II\/AAAAAAAAAX4\/sQ2_7-OYWCw\/s400\/ScriptToolsavephotosresult.jpg\" border=\"0\" alt=\"\"id=\"BLOGGER_PHOTO_ID_5409142985025902722\" \/><\/a><br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u4f3c\u4e4e\u4e0d\u660e\u663e\uff0c\u90a3\u5c31\u5229\u7528\u7a7a\u95f4\u5206\u6790\u4e2d\u7684Point Density\u5de5\u5177\u62bd\u8c61\u4e00\u4e0b\u4f4d\u7f6e\u5206\u5e03\u4fe1\u606f\uff1a<br \/><a onblur=\"try {parent.deselectBloggerImageGracefully();} catch(e) {}\" href=\"http:\/\/4.bp.blogspot.com\/_DD8LUY9p6iU\/SxE7J7wFNPI\/AAAAAAAAAYA\/Ru893JTQnIU\/s1600\/ScriptToolsavephotosresult2.jpg\"><img decoding=\"async\" style=\"display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 308px;\" src=\"http:\/\/4.bp.blogspot.com\/_DD8LUY9p6iU\/SxE7J7wFNPI\/AAAAAAAAAYA\/Ru893JTQnIU\/s400\/ScriptToolsavephotosresult2.jpg\" border=\"0\" alt=\"\"id=\"BLOGGER_PHOTO_ID_5409169669292897522\" \/><\/a><br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u4e5f\u53ef\u4ee5\u5229\u7528Model\uff0c\u5c06\u4e24\u90e8\u5206\u8fde\u63a5\u8d77\u6765\uff0c\u505a\u6210\u4e00\u4e2a\u5de5\u5177\u6765\u7528\uff1a<br \/><a onblur=\"try {parent.deselectBloggerImageGracefully();} catch(e) {}\" href=\"http:\/\/4.bp.blogspot.com\/_DD8LUY9p6iU\/SxE--RtPhPI\/AAAAAAAAAYI\/F2T6l72AmBw\/s1600\/Modelsavephotos_PDensity.jpg\"><img decoding=\"async\" style=\"display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 348px; height: 400px;\" src=\"http:\/\/4.bp.blogspot.com\/_DD8LUY9p6iU\/SxE--RtPhPI\/AAAAAAAAAYI\/F2T6l72AmBw\/s400\/Modelsavephotos_PDensity.jpg\" border=\"0\" alt=\"\"id=\"BLOGGER_PHOTO_ID_5409173867074651378\" \/><\/a><br \/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u6709\u4e86\u5730\u7406\u6570\u636e\uff0c\u5c31\u53ef\u4ee5\u7ee7\u7eed\u5728\u5176\u4ed6\u5e73\u53f0\u4e0b\u8fdb\u884c\u5904\u7406\u548c\u5c55\u793a\u4e86\uff1a<br \/><a onblur=\"try {parent.deselectBloggerImageGracefully();} catch(e) {}\" href=\"http:\/\/1.bp.blogspot.com\/_DD8LUY9p6iU\/SxFBZLKVBNI\/AAAAAAAAAYQ\/7GE-CbHE-Vg\/s1600\/myphotosheatmap.jpg\"><img decoding=\"async\" style=\"display:block; margin:0px auto 10px; text-align:center;cursor:pointer; cursor:hand;width: 400px; height: 357px;\" src=\"http:\/\/1.bp.blogspot.com\/_DD8LUY9p6iU\/SxFBZLKVBNI\/AAAAAAAAAYQ\/7GE-CbHE-Vg\/s400\/myphotosheatmap.jpg\" border=\"0\" alt=\"\"id=\"BLOGGER_PHOTO_ID_5409176528197321938\" \/><\/a><br \/>\u6700\u540e\u603b\u7ed3\u4e00\u4e0b\u6807\u9898\uff1a\u901a\u8fc7Python\uff0c\u4e0d\u9700\u8981\u4e00\u4e2astand-alone\u7684\u7a0b\u5e8f\uff0c\u5c31\u53ef\u4ee5\u5feb\u901f\u8bd5\u9a8c\u4e00\u4e2a\u60f3\u6cd5\u3002<br \/>btw\uff1a\u9644\u4e0a\u6700\u8fd1google map tile\u7684\u83b7\u53d6\u65b9\u6cd5\uff1a<br \/><code><br \/>public override string GetTileUrl(int level, int row, int col)<br \/>        {<br \/>            int servernum = (col + 2 * row) % 4;<br \/>            string sec2 = \"&s=\"; \/\/ after &zoom=...<br \/>            string secword = \"Galileo\";<br \/>            int seclen = ((col * 3) + row) % 8; \/\/ corrected from int seclen = ( col + 3 * row ) % 8;<br \/>            sec2 += secword.Substring(0, seclen);<\/p>\n<p>            \/\/google maps map:<br \/>            \/\/http:\/\/mt1.google.com\/vt\/lyrs=m@114&hl=zh-CN&x=13&y=5&z=4&s=Gali<br \/>            \/\/http:\/\/mt1.google.com\/vt\/lyrs=m@114&hl=zh-CN&x=13&y=6&z=4&s=Galil<br \/>            \/\/http:\/\/mt1.google.com\/vt\/lyrs=m@114&hl=zh-CN&x=13&y=8&z=4&s=Galileo<br \/>            string baseUrl = \"http:\/\/mt\" + servernum.ToString() + \".google.com\/vt\/lyrs=m@114&hl=zh-CN&x=\";<br \/>            string url = baseUrl + col.ToString() + \"&y=\" + row.ToString() + \"&z=\" + level.ToString() + sec2;<br \/>            return url;<\/p>\n<p>            \/\/\/\/google maps satallite<br \/>            \/\/\/\/http:\/\/khm1.google.com\/kh\/v=49&x=3&y=5&z=4&s=Galile<br \/>            \/\/string baseUrl = \"http:\/\/khm\" + servernum.ToString() + \".google.com\/kh\/v=49&x=\";<br \/>            \/\/string url = baseUrl + col.ToString() + \"&y=\" + row.ToString() + \"&z=\" + level.ToString() + sec2;<br \/>            \/\/return url;<br \/>        }<br \/><\/code><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Python\u4f5c\u4e3a\u4e00\u79cd\u6210\u719f\u7684\u811a\u672c\u8bed\u8a00\uff0c\u53d1\u5c55\u52bf\u5934\u8fc5\u731b\uff0c\u957f\u671f\u5f98\u5f8a\u5728\u201c\u7f16\u7a0b\u8bed\u8a00\u8c31\u201d\u6392\u884c\u524d5\u7684\u4f4d\u7f6e\uff0c\u5728\u811a\u672c\u8bed\u8a00\u4e2d\u4ec5\u6b21\u4e8ephp\u3002\u901a\u8fc7Python\uff0c\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u5feb\u901f\u8bd5\u9a8c\u4e00\u4e2a\u60f3\u6cd5\u3001\u7814\u7a76\u4e00\u79cd\u5bf9\u8c61\u5c5e\u6027\u6216\u4e0d\u540c\u7b97\u6cd5\uff0c\u800c\u65e0\u9700\u7f16\u8bd1\u3001\u6267\u884c\u548c\u6d4b\u8bd5\u4efb\u4f55\u4ee3\u7801\u3002\u6b63\u662f\u56e0\u4e3a\u8de8\u5e73\u53f0\u3001\u7b80\u6d01\u3001\u4f18\u7f8e\u7684\u7279\u70b9\uff0c\u5b83\u4e5f\u5982\u540cGIS\u5e94\u7528\u6e17\u900f\u4e8e\u5404\u5404\u4e2a\u884c\u4e1a\u4e00\u6837\uff0c\u6e17\u900f\u5728\u79d1\u5b66\u8ba1\u7b97\u7684\u5404\u4e2a\u9886\u57df\u3002\u5728GIS\u9886\u57df\uff0c\u51e0\u4e4e\u53ef\u4ee5\u8bf4\u5f00\u6e90\u8a00\u5fc5\u79f0Python\uff1b\u800cArcGIS\u5219\u5c06Python\u79f0\u4e3athe scientific programming language for GIS\uff1aArcGIS Server\u7684\u731b\u5c06Geoprocessing Service\u4f9d\u8d56\u4e8ePython\uff0c\u4ece9.4\u5c06Python IDE\u96c6\u6210\u5230ArcMap\u4e2d\u4e5f\u53ef\u89c1\u4e00\u6591\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u524d\u4e00\u9635Flyingis\u8d34\u51fa\u4e86\u4e00\u7bc7\u7c7b\u4f3c\u7684\u6587\u7ae0\uff0c\u4e0d\u8fc7\u8fd8\u662f\u901a\u8fc7\u52a8\u624b\u5b8c\u6210\u4e00\u4e2a\u5b9e\u4f8b\uff0c\u6765\u770b\u770b\u5b83\u5728ArcMap\u4e2d\u7684\u6570\u636e\u5feb\u901f\u5904\u7406\u80fd\u529b\u5427\u3002\u63cf\u8ff0\uff1a\u4e0a\u4f20\u5230Panoramio\u7684\u7167\u7247\u90fd\u4f1a\u6709\u4f4d\u7f6e\u4fe1\u606f\uff08\u7ecf\u7eac\u5ea6\u5750\u6807\uff09\uff0c\u6709\u4e9b\u670b\u53cb\u975e\u5e38\u53ef\u656c\uff0c\u4e0a\u4f20\u7684\u7167\u7247\u6570\u91cf\u53ef\u8fbe\u4e0a\u4e07\u5f20\u3002\u5206\u6790\u4e00\u4e0b\u67d0\u4e2a\u7528\u6237\u62cd\u7167\u7684\u6d3b\u52a8\u8303\u56f4\uff0c\u662f\u4ef6\u6709\u8da3\u548c\u6709\u610f\u4e49\u7684\u4e8b\u60c5\u3002\u601d\u8def\uff1a1\u3001\u5229\u7528Panoramio\u7684API\uff0c\u83b7\u53d6\u6307\u5b9a\u7528\u6237\u7684\u6240\u6709\u7167\u7247\u4fe1\u606f\uff1b2\u3001\u5c06\u5173\u5fc3\u7684\u4fe1\u606f\uff0c\u6bd4\u5982\u4f5c\u8005\u3001\u7167\u7247\u540d\u79f0\u3001\u7167\u7247\u6587\u4ef6\u94fe\u63a5\u63d0\u53d6\u51fa\u6765\uff0c\u5e76\u5c06\u5176\u5b58\u50a8\u5230\u5730\u7406\u6570\u636e\u5e93\u4e2d\u3002&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;\u7b2c\u4e00\u6b65\uff1a\u83b7\u53d6\u7167\u7247\u4fe1\u606f\u3002\u5148\u770b\u4e00\u4e0bPanoramio\u7684API\uff0cREST\u98ce\u683c\uff0c\u8fd4\u56deJSON\u5b57\u7b26\u4e32\u3002\u6bd4\u5982\u901a\u8fc7http:\/\/www.panoramio.com\/map\/get_panoramas.php?order=popularity&#038;set=public&#038;from=0&#038;to=20&#038;minx=-180&#038;miny=-90&#038;maxx=180&#038;maxy=90&#038;size=medium\uff0c\u5373\u53ef\u6309\u70b9\u51fb\u6b21\u6570\u6392\u5e8f\u83b7\u5f97\u4e16\u754c\u8303\u56f4\u5185\u6240\u6709\u53d7\u6b22\u8fce\u7684\u7167\u7247\u3002{ &#8220;count&#8221;: 773840,&#8221;photos&#8221;: [ { &#8220;photo_id&#8221;: 532693, &#8220;photo_title&#8221;: &#8220;Wheatfield in afternoon light&#8221;, &#8220;photo_url&#8221;: &#8220;http:\/\/www.panoramio.com\/photo\/532693&#8221;, &#8220;photo_file_url&#8221;: &#8220;http:\/\/static2.bareka.com\/photos\/medium\/532693.jpg&#8221;, &#8220;longitude&#8221;: 11.280727, &#8220;latitude&#8221;: 59.643198, &#8220;width&#8221;: 500, &#8220;height&#8221;: 333, &#8220;upload_date&#8221;: &#8220;22 January 2007&#8221;, &#8220;owner_id&#8221;: 39160, &#8220;owner_name&#8221;: &#8220;Snemann&#8221;, &#8220;owner_url&#8221;: &#8220;http:\/\/www.panoramio.com\/user\/39160&#8221;, }, { &#8220;photo_id&#8221;: 505229, &#8220;photo_title&#8221;: &#8220;Etangs pr\u00e8s de Dijon&#8221;, &#8220;photo_url&#8221;: &#8220;http:\/\/www.panoramio.com\/photo\/505229&#8221;, &#8220;photo_file_url&#8221;: &#8220;http:\/\/static2.bareka.com\/photos\/medium\/505229.jpg&#8221;, &#8220;longitude&#8221;: 5.168552, &#8220;latitude&#8221;: 47.312642, &#8220;width&#8221;: 350, &#8220;height&#8221;: 500, &#8220;upload_date&#8221;: &#8220;20 &hellip; <a href=\"https:\/\/blog.newnaw.com\/?p=445\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Python\u9b45\u529b\u4e4b\u5730\u7406\u6570\u636e\u5feb\u901f\u5904\u7406\u65b9\u6cd5<\/span> <span class=\"meta-nav\">&raquo;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.newnaw.com\/index.php?rest_route=\/wp\/v2\/posts\/445"}],"collection":[{"href":"https:\/\/blog.newnaw.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.newnaw.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.newnaw.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.newnaw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=445"}],"version-history":[{"count":0,"href":"https:\/\/blog.newnaw.com\/index.php?rest_route=\/wp\/v2\/posts\/445\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.newnaw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=445"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.newnaw.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=445"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.newnaw.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=445"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}