/// <Summary> /// Calculate the volume between two surfaces /// </Summary> /// <Param name = "usfolder"> Parent directory on top </Param> /// <Param name = "usdataset"> Top directory name </Param> /// <Param name = "dsfolder"> Parent directory on the lower surface </Param> /// <Param name = "dsdataset"> Directory Name </Param> Public Void Calculatecutfill ( String Usfolder, String Usdataset, String Dsfolder, String Dsdataset ){ // Set cellsize for cutfill Analysis /* Object cellsize = 0.345; rastersurfaceopclass rclass = new rastersurfaceopclass (); rclass. setcellsize (response. esrirasterenvvalue, ref cellsize); isurfaceop psurfaceop = rclass; */ /* Itin ptinup = gettinlayer (usfolder, usdataset); itin ptindown = gettinlayer (dsfolder, dsdataset); igeodataset placement = ptinup as igeodataset; // you can use tin to directly perform cutfill In ArcMap. however, in the engine, only raster can be used as isurfaceop. cutfill parameter igeodataset pgeodsdown = ptindown as igeodataset; */ // If you use itin to convert to geodataset as the parameter, the prompt is invalidinputgeodataset. // Processing Method: first use tintoraster of 3danalysis to convert two tin into raster Isurfaceop psurfaceop = New Rastersurfaceopclass (); igeodataset pgeodsup = Openrasterdataset ( @" E: \ shpforcontour \ javasfromshp " , " Tin2529raster " ) As Igeodataset; // Isurfaceop. cutfill (geods, geods, OBJ) Igeodataset pgeodsdown = openrasterdataset ( @" E: \ shpforcontour \ javasfromshp " , " Tinbottomrar " ) As Igeodataset; // Geods requires rasterdataset. tindataset does not work. Object Zfactor = New Object (); Zfactor = 1.0 ; Igeodataset pgeodsresult = Psurfaceop. cutfill (pgeodsup, pgeodsdown, Ref Zfactor ); // Cutfill Analysis // Read raster Attribute Table Iraster praseter = pgeodsresult As Iraster;// Igeodataset to iraster Irasterbandcollection prasterbc = praseter As Irasterbandcollection; irasterband prasterband = Prasterbc. Item ( 0 ); Itable ptable = Prasterband. attributetable; icursor pcursor = Ptable. Search ( Null , False ); Irow prow = Pcursor. nextrow (); datatable dt =New Datatable (); For ( Int I = 0 ; I <ptable. Fields. fieldcount; I ++ ) {DT. Columns. Add (ptable. Fields. get_field (I). Name ); // MessageBox. Show (ptable. Fields. get_field (I). Name ); // Field name } While (Prow! =Null ){ // The value of the count field is shown below Datarow DR = DT. newrow (); For ( Int I = 0 ; I <= DT. Columns. Count- 1 ; I ++ ) {Dr [I] = Convert. tostring (prow. get_value (I);} DT. Rows. Add (DR); prow =Pcursor. nextrow ();}}
Note:
In ArcMap, surfaceanalysis cutfill analysis results can only be saved to three types: ESRI grid (raster), Tiff, and ERDAS. All three types of data are raster data.