mxd脚本
1. 关于arcgis的python脚本编程, shape文件出png图片问题
1、点类型的转栅格:
PointToRasterexample1(Python
window)
.
importarcpy
fromarcpyimportenv
env.workspace="c:/data"
arcpy.PointToRaster_conversion("ca_ozone_pts.shp","ELEVATION",
"c:/output/ca_elev","MAXIMUM","",2000)
PointToRasterexample2
(stand-alonescript)
.
#Name:PointToRaster_Ex_02.py
#Description:.
#Requirements:ArcInfo
#Importsystemmoles
importarcpy
fromarcpyimportenv
#Setenvironmentsettings
env.workspace="C:/data"
#Setlocalvariables
inFeatures="ca_ozone_pts.shp"
valField="ELEVATION"
outRaster="c:/output/ca_elev02"
assignmentType="MAXIMUM"
priorityField=""
cellSize=2000
#ExecutePointToRaster
arcpy.PointToRaster_conversion(inFeatures,valField,outRaster,
assignmentType,priorityField,cellSize)
2、面类型的转栅格:
PolygonToRasterexample1
(Pythonwindow)
.
importarcpy
fromarcpyimportenv
env.workspace="c:/data"
arcpy.PolygonToRaster_conversion("ca_counties.shp","NAME",
"c:/output/ca_counties.img",
"MAXIMUM_AREA","MALES",0.25)
PolygonToRasterexample2
(stand-alonescript)
.
#Name:PolygonToRaster_Ex_02.py
#Description:.
#Requirements:ArcInfo
#Importsystemmoles
importarcpy
fromarcpyimportenv
#Setenvironmentsettings
env.workspace="C:/data"
#Setlocalvariables
inFeatures="ca_counties.shp"
valField="NAME"
outRaster="c:/output/ca_counties"
assignmentType="MAXIMUM_AREA"
priorityField="MALES"
cellSize=0.5
#ExecutePolygonToRaster
arcpy.PolygonToRaster_conversion(inFeatures,valField,outRaster,
assignmentType,priorityField,cellSize)
3、线类型转栅格
PolylineToRasterexample1
(Pythonwindow)
.
importarcpy
fromarcpyimportenv
env.workspace="c:/data"
arcpy.PolylineToRaster_conversion("roads.shp","CLASS","c:/output/roads.img",
"MAXIMUM_COMBINED_LENGTH","LENGTH",30)
PolylineToRasterexample2
(stand-alonescript)
.
#Name:PolylineToRaster_Ex_02.py
#Description:.
#Requirements:ArcInfo
#Importsystemmoles
importarcpy
fromarcpyimportenv
#Setenvironmentsettings
env.workspace="C:/data"
#Setlocalvariables
inFeatures="roads.shp"
valField="CLASS"
outRaster="c:/output/roads.tif"
assignmentType="MAXIMUM_COMBINED_LENGTH"
priorityField="LENGTH"
cellSize=30
#ExecutePolylineToRaster
arcpy.PolylineToRaster_conversion(inFeatures,valField,outRaster,
assignmentType,priorityField,cellSize)
2. mxd鏂囦欢淇鏀规暟鎹婧愯佺礌闆嗕笉钖
瀵逛簬mxd鏂囦欢淇鏀规暟鎹婧愯佺礌闆嗕笉钖岀殑铡熷洜链変互涓嫔嚑镣癸细
1. 鏁版嵁婧愭枃浠惰矾寰勫彉镟达细褰搈xd鏂囦欢涓寮旷敤镄勬暟鎹婧愭枃浠剁殑璺寰勫彂鐢熷彉鍖栨椂锛屼緥濡傛枃浠惰绉诲姩鍒板叾浠栨枃浠跺す鎴栭吨锻藉悕锛宫xd鏂囦欢灏辨棤娉曟垒鍒扮浉搴旂殑鏁版嵁婧愭枃浠讹纴瀵艰嚧瑕佺礌闆嗕笉钖屻
2. 鏁版嵁婧愭枃浠惰鍒犻櫎鎴栨崯鍧忥细濡傛灉mxd鏂囦欢涓寮旷敤镄勬暟鎹婧愭枃浠惰鍒犻櫎鎴栬呮崯鍧忥纴mxd鏂囦欢灏辨棤娉曡块梾鐩稿簲镄勬暟鎹锛屽艰嚧瑕佺礌闆嗕笉钖屻
3. 鏁版嵁搴撹繛鎺ラ梾棰桡细濡傛灉mxd鏂囦欢涓寮旷敤镄勬暟鎹婧愭槸鏁版嵁搴掳纴褰撴暟鎹搴撹繛鎺ュ彂鐢熼梾棰樻椂锛屼緥濡傛暟鎹搴揿悕绉版垨锏诲綍鍑鎹鍙戠敓鍙桦寲锛宫xd鏂囦欢镞犳硶姝g‘杩炴帴鏁版嵁搴掳纴瀵艰嚧瑕佺礌闆嗕笉钖屻
闇瑕佹敞镒忕殑鏄锛屽綋mxd鏂囦欢淇鏀规暟鎹婧愯佺礌闆嗕笉钖屾椂锛屽彲鑳戒细瀵艰嚧鍦板浘鏄剧ず涓嶅嗳纭鎴栨棤娉曟e父锷犺浇鏁版嵁銆傚湪瑙e喅姝ら梾棰樻椂锛屽彲浠ュ皾璇曚互涓嬫柟娉曪细
1. 閲嶆柊杩炴帴鏁版嵁婧愶细阃氲繃淇鏀筸xd鏂囦欢涓镄勬暟鎹婧愯矾寰勬垨閲嶆柊閰岖疆鏁版嵁搴撹繛鎺ヤ俊鎭锛岀‘淇漨xd鏂囦欢鑳藉熸g‘璁块梾鍒扮浉搴旂殑鏁版嵁婧愭枃浠躲
2. 瀵绘垒澶囦唤鏂囦欢锛氩傛灉涔嫔墠链夊囦唤镄刴xd鏂囦欢锛屽彲浠ュ皾璇曚娇鐢ㄥ囦唤鏂囦欢镟挎崲褰揿墠镄刴xd鏂囦欢锛屼互鎭㈠嶅埌涔嫔墠镄勬暟鎹婧愯佺礌闆嗐
3. 閲嶆柊锷犺浇鏁版嵁锛氩傛灉鏁版嵁婧愭枃浠舵湭琚鍒犻櫎鎴栨崯鍧忥纴浣嗘槸mxd鏂囦欢镞犳硶姝g‘璁块梾锛屽彲浠ュ皾璇曢吨鏂板姞杞芥暟鎹锛岀‘淇濇暟鎹婧愭枃浠剁殑鍙鐢ㄦс
镐讳箣锛宫xd鏂囦欢淇鏀规暟鎹婧愯佺礌闆嗕笉钖屽彲鑳芥槸鐢变簬鏂囦欢璺寰勫彉镟淬佹暟鎹婧愭枃浠舵崯鍧忔垨鏁版嵁搴撹繛鎺ラ梾棰樼瓑寮曡捣镄勚傚湪瑙e喅闂棰樻椂锛屽彲浠ュ皾璇曢吨鏂拌繛鎺ユ暟鎹婧愩佷娇鐢ㄥ囦唤鏂囦欢鎴栭吨鏂板姞杞芥暟鎹𨱒ユ仮澶嶆g‘镄勮佺礌闆嗐
3. 鍐呰屾潵锻婅瘔涓嫔啋闄╁矝绾㈤蓟瀛愭捣鐩2镄勫偦鎸傝剼链瑍锛
璧板埌,1073,70
璧板埌,750,70
璺宠穬
涓婄埇
璧板埌,35,-94
璺宠穬
涓婄埇
璧板埌,-874,70
寰鐜
镊宸卞纰鎴怲XT鏂囦欢灏监K 銆伞
4. 镐庢牱浣跨敤python宸ュ叿杩涜屾壒閲忓嚭锲撅纻
1銆侀栧厛锛屾垜浠瑕佽繘琛屾壒閲忓嚭锲撅纴浣嗘槸鏁版嵁椹卞姩椤甸溃鍙鑳芥壒閲忓嚭pdf镙煎纺镄勫浘銆备笉澶鏂逛究銆傚湪杩欑嶆儏鍐典笅銆傛垜锻婅瘔澶у朵竴涓鍙浠ユ壒閲忓煎嚭鍏朵粬镙煎纺濡傦细JPG镙煎纺锲剧墖镄勬柟娉曘