private void lBatch(string[] paramArr, string outName) { batchCalculations btch = new batchCalculations(rsUtil, rp); btch.BatchPath = paramArr[0]; btch.loadBatchFile(); btch.runBatch(); string desc; object fObj; btch.getFinalObject(out outName, out fObj, out desc); if (fObj is String) { modelDic[outName] = fObj.ToString(); } else if (fObj is RasterDataset) { rstDic[outName] = (IFunctionRasterDataset)fObj; } else if (fObj is FeatureClass) { ftrDic[outName] = (IFeatureClass)fObj; } else { tblDic[outName] = (ITable)fObj; } }
public void syntaxExample(batchCalculations.batchGroups batchFunction) { string msg = "working on this"; switch (batchFunction) { case batchGroups.ARITHMETIC: msg = "outRS = " + batchFunction.ToString() + "(in_Raster1;in_Raster2;arithmeticFunction)"; break; case batchGroups.MATH: msg = "outRS = " + batchFunction.ToString() + "(in_Raster1;mathFunction)"; break; case batchGroups.SETNULL: msg = "outRS = " + batchFunction.ToString() + "(in_Raster1;0-4,8-9,13-15)"; break; case batchGroups.LOGICAL: msg = "outRS = " + batchFunction.ToString() + "(in_Raster1;in_Raster2;logicalOperator)"; break; case batchGroups.CLIP: msg = "outRS = " + batchFunction.ToString() + "(in_Raster;inFeatureClass)"; break; case batchGroups.CONDITIONAL: msg = "outRS = " + batchFunction.ToString() + "(in_Raster1;in_Raster2;in_Raster3)"; break; case batchGroups.CONVOLUTION: msg = "outRS = " + batchFunction.ToString() + "(in_Raster1;width;height;0,1,0,1,0,1,0,1,0)"; break; case batchGroups.FOCAL: msg = "outRS = " + batchFunction.ToString() + "(in_Raster1;width;height;focalStat)\noutRS = " + batchFunction.ToString() + "(in_Raster1;radius;focalStat)"; break; case batchGroups.LOCALSTATISTICS: msg = "outRs = " + batchFunction.ToString() + "(inRaster1,inRaster2;localType)"; break; case batchGroups.LINEARTRANSFORM: msg = "outRs = " + batchFunction.ToString() + "(inRaster;betas{0.12,2.25,1,6.3}; intercept should be the first number)"; break; case batchGroups.RESCALE: msg = "outRs = " + batchFunction.ToString() + "(inRaster)"; break; case batchGroups.REMAP: msg = "outRs = " + batchFunction.ToString() + "(inRaster;0:1:100,1:6:200,6:1000:300)"; break; case batchGroups.COMPOSITE: msg = "outRs = " + batchFunction.ToString() + "(inRaster;inRaster2;inRaster3)"; break; case batchGroups.EXTRACTBAND: msg = "outRs = " + batchFunction.ToString() + "(inRaster;1,2,5)"; break; case batchGroups.GLCM: msg = "outRS = " + batchFunction.ToString() + "(in_Raster1;width;height;horizontal(true,false);glcmMetric)\noutRS = " + batchFunction.ToString() + "(in_Raster1;radius;horizontal(true,false);glcmMetric)"; break; case batchGroups.LANDSCAPE: msg = "outRS = " + batchFunction.ToString() + "(in_Raster1;width;height;focalType;landType)\noutRS = " + batchFunction.ToString() + "(in_Raster1;radius;focalType;landType)"; break; case batchGroups.ZONALSTATS: msg = "outTbl = " + batchFunction.ToString() + "(ZoneRaster;ValueRaster;OutTableName;MAX,MIN,SUM)\noutTbl = " + batchFunction.ToString() + "(ZoneFeatureClass;ZoneField;ValueRaster2;OutTableName;MAX,MIN,SUM)"; break; case batchGroups.ZONALCLASSCOUNTS: msg = "outTbl = " + batchFunction.ToString() + "(ZoneRaster;ValueRaster;OutTableName)\noutTbl = " + batchFunction.ToString() + "(ZoneFeatureClass;ZoneField;ValueRaster2;OutTableName)"; break; case batchGroups.SAVEFUNCTIONRASTER: msg = "outRs = " + batchFunction.ToString() + "(inRaster;outName;outWorkspace;rasterType)"; break; case batchGroups.BUILDRASTERSTATS: msg = "outRS = " + batchFunction.ToString() + "(in_Raster;skipFactor)"; break; case batchGroups.BUILDRASTERVAT: msg = "outTable = " + batchFunction.ToString() + "(in_Raster)"; break; case batchGroups.MOSAIC: msg = "outFtrClass = " + batchFunction.ToString() + "(wks; mosaicDatasetName; inRaster1,inRaster2,inRaster3; mosaicmethod; mosaictype; buildfootprint; buildboundary; seemlines; buildOverview)"; break; case batchGroups.MERGE: msg = "outFtrClass = " + batchFunction.ToString() + "(inRaster1,inRaster2,inRaster3;mergeType)"; break; case batchGroups.SAMPLERASTER: msg = "outFtrClass = " + batchFunction.ToString() + "(inFeatureClass;sampleRaster;FieldNamePrefix)"; break; case batchGroups.CLUSTERSAMPLERASTER: msg = "outFtrClass = " + batchFunction.ToString() + "(inFeatureClass;sampleRaster;FieldNamePrefix;15:56,180:56,274:75;typeOfCluster)"; break; case batchGroups.CREATERANDOMSAMPLE: msg = "outFtrClass = " + batchFunction.ToString() + "(inFeatureClass;sampleRaster;100;OutName)"; break; case batchGroups.CREATESTRATIFIEDRANDOMSAMPLE: msg = "outFtrClass = " + batchFunction.ToString() + "(inFeatureClass;sampleRaster;20,65,75,10;OutName)"; break; case batchGroups.FOCALSAMPLE: msg = "outRS = " + batchFunction.ToString() + "(in_Raster;360:37.56,120:26.25,240:2;focalType)"; break; case batchGroups.CONVERTPIXELTYPE: msg = "outRs = " + batchFunction.ToString() + "(inRaster;rstPixelType)"; break; case batchGroups.MODEL: msg = "outRs = " + batchFunction.ToString() + "(inRaster;modelPath)"; break; case batchGroups.AGGREGATION: msg = "outRs = " + batchFunction.ToString() + "(inRaster;cells;Aggregation Type)"; break; case batchGroups.PREDICT: msg = "outTable = " + batchFunction.ToString() + "(inTable;modelPath)"; break; case batchGroups.BUILDMODEL: msg = "outModel = " + batchFunction.ToString() + "(modelType;model parameters)\nRandomForest Example:\n\toutModel = " + batchFunction.ToString() + "(RandomForest;featureClassPath;DependentField;IndependentFields(comma separated);categoricalFields(comma separated);Trees;Ratio;NumberOfSplitVariables;outputModelPath)"; break; case batchGroups.COMBINE: msg = "outRs = " + batchFunction.ToString() + "(inRaster;inRaster2;inRaster3)"; break; case batchGroups.CONSTANT: msg = "outRs = " + batchFunction.ToString() + "(inRaster;constantValue)"; break; case batchGroups.ROTATE: msg = "outRs = " + batchFunction.ToString() + "(inRaster;degrees)"; break; case batchGroups.SHIFT: msg = "outRs = " + batchFunction.ToString() + "(inRaster;CellsX,CellsY)"; break; case batchGroups.NULLTOVALUE: msg = "outRs = " + batchFunction.ToString() + "(inRaster;newValue)"; break; case batchGroups.SELECTSAMPLES: msg = "outTbl = " + batchFunction.ToString() + "(inTable;inStatumField;inModel;Proportion;Alpha;false)"; break; case batchGroups.EXPORTTABLE: msg = "outTbl = " + batchFunction.ToString() + "(inTable;query;outTablePath)"; break; case batchGroups.EXPORTFEATURECLASS: msg = "outFeatureClass = " + batchFunction.ToString() + "(inFeatureClass;query;outFeatureClassPath)"; break; case batchGroups.SURFACE: msg = "outRs = " + batchFunction.ToString() + "(inRaster;surfaceType)"; break; case batchGroups.RENAMEFIELD: msg = "outTbl = " + batchFunction.ToString() + "(inTable;oldFieldName;newFieldName)"; break; case batchGroups.FORMATZONAL: msg = "outTbl = " + batchFunction.ToString() + "(inZoneTable;linkFieldName;inZonalSummaryTable;FieldPrefix)"; break; case batchGroups.SETVALUESTONULL: msg = "outRs = " + batchFunction.ToString() + "(inRaster;Band1,min1,max1:Band2,min2,max2:Band3,min3,max3)"; break; case batchGroups.RESAMPLE: msg = "outRs = " + batchFunction.ToString() + "(inRaster;cellSizeInMapUnits)"; break; case batchGroups.NDVI: msg = "outRs = " + batchFunction.ToString() + "(inRaster;redBand;irBand)"; break; case batchGroups.LOCALRESCALE: msg = "outRs = " + batchFunction.ToString() + "(inRaster;rasterUtil.localRescaleType)"; break; case batchGroups.CREATERASTERATTRIBUTE: msg = "outTBL = " + batchFunction.ToString() + "(inRaster;outTablePath)"; break; case batchGroups.LOCALFOCALSTATISTICS: msg = "outRs = " + batchFunction.ToString() + "(inRaster;statistic;bandsBefore;bandsAfter)"; break; case batchGroups.LOAD: msg = "outObject = " + batchFunction.ToString() + "(BatchPath)"; break; case batchGroups.OPENRASTER: msg = "outRs = " + batchFunction.ToString() + "(RasterPath)"; break; case batchGroups.OPENFEATURECLASS: msg = "outFtr = " + batchFunction.ToString() + "(FeatureClassPath)"; break; case batchGroups.OPENTABLE: msg = "outTBL = " + batchFunction.ToString() + "(TablePath)"; break; case batchGroups.OPENMODEL: msg = "outMDL = " + batchFunction.ToString() + "(ModelPath)"; break; default: break; } System.Windows.Forms.MessageBox.Show(msg); }
public void createBatchRaster(out string nm, out object rs, out string desc) { nm = null; rs = null; desc = null; if (path == "" || !System.IO.File.Exists(path)) { return; } try { batchCalculations btch = new batchCalculations(rsUtil, new Forms.RunningProcess.frmRunningProcessDialog(true)); btch.BatchPath = path; btch.loadBatchFile(); btch.runBatch(); btch.getFinalObject(out nm, out rs, out desc); } catch { } finally { } }