Arcengine implements cut/fill in surfaceanalysis

Source: Internet
Author: User
 ///   <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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.