import arcpy, sys, os, subprocess from arcpy import env #Supply the following arguments prior to running: #Workspace (full path) #Catchment Polygons (full path) #Raster Data (full path) #Prefix for the output: 6 characters to denote the raster dataset. #Thematic value: TRUE or FALSE #An output txt file (full path -> eg. C:/Users/Alison/Desktop/file.txt) ######## #Each argument must be in double quotes, and they must be separated by a space. #The polygon and raster datasets must be in same coordinate system. env.workspace = sys.argv[1] print env.workspace inputPoly = sys.argv[2] inputRast = sys.argv[3] prefix = sys.argv[4] thematic = sys.argv[5] code = 'isectpolyrst(in="' + inputPoly + '", raster="' + inputRast + '", prefix="' + prefix + '", thematic="' + thematic +'");' print code newFile = sys.argv[6] print newFile newFileObj = open(newFile, 'w') newFileObj.write(code) newFileObj.close() print newFile os.system(r'C:\Program Files (x86)\SpatialEcology\GME\SEGME.exe') print "subprocess.call(r'C:\Program Files (x86)\SpatialEcology\GME\SEGME.exe -c run(in=\\\"" + newFile + "\\\");');" subprocess.call(r'C:\Program Files (x86)\SpatialEcology\GME\SEGME.exe -c run(in=\\\"" + newFile + "\\\");');
gmePath = r"C:\Program Files (x86)\SpatialEcology\GME\SEGME.exe" for raster in rasters: os.system(gmePath + " isectpolyrst(in=\"" + grid + "\", raster = \"" + raster + "\", prefix = \"" + raster[:3] + "\", where \"Year=2007\");")
Dir = r"C:\Users\GISuser\Desktop\ONeil_2011\Scaup Folders\Habitat Attributes\2007" env.workspace = Dir rasters = arcpy.ListRasters() for raster in rasters: print raster
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.