Arcpy - Calculate volume using CutFill tool

1782
10
02-09-2017 06:25 PM
neolab
by
New Contributor

Hi guys,

Currently i'm implementing a function to calculate volume  of  a polygon using CutFill tool. Here is my step:

# I clip the raster with polygon

arcpy.Clip_management(Elevation_Raster, "#", clipped_raster ,Input_Polygon_Shp, "0", "ClippingGeometry")

# I convert the clipped raster to multipoint in order to create TIN

arcpy.RasterToMultipoint_3d(clipped_raster, points, "", "KERNEL", "MEAN", "", "")

# I create TIN from multipoint since it then convert it back to raster to "flatten" the surface

arcpy.CreateTin_3d(tin, sr, points, "Delaunay")

arcpy.TinRaster_3d(tin, raster_tin, "FLOAT", "NATURAL_NEIGHBORS", TinRastCellSize, "")

# Finally i run the CutFill tool

outCutFill = CutFill(clipped_raster, raster_tin, 1)

But the result is not correct. Did i miss something or can you guys show me the way to get volume using CutFill tool? Thank you alot

0 Kudos
10 Replies
DanPatterson_Retired
MVP Emeritus

Cut - Fill and how cut fill works  When you say the results aren't right, then that raises the questions

  • are the data in projected coordinates?
  • is the z-factor correct?
  • in a perfect example, your results would be in meters cubed

In your example, you used a z-factor of 1, which should mean that your projected coordinate system is in meters because the X,Y values are so... or all 3 are in feet which would be less likely.

Information on the coordinate system and the values you got would be useful.

0 Kudos
neolab
by
New Contributor

Thank you alot Mr Patterson

1/ Yes all my raster is in projected coordinate (WGS 1984 UTM Zone 54N) and using meter unit

2/ The result is not correct because the surface after my processing and the original one is slightly different and i don't know why?

In fact, i used the FeatureVerticesToPoints_management and then ExtractValuesToPoints to produce the point feature which will be used to create TIN at the beginning and it give me good result, but unluckily FeatureVerticesToPoints_management is just exist in ADVANCE plan of Argis Pro and i can't afford it, so i try to use the RasterToMultipoint_3d instead but the result is not correct.

0 Kudos
DanPatterson_Retired
MVP Emeritus

why the hoops?  both the 3D and spatial analyst make use of the same algorithm and you should be using rasters as inputs, I suspect that the extra things you are doing is causing an issue with cell size issues/differences.  Assess the raster results for the correct values, not some conversion to TIN

0 Kudos
neolab
by
New Contributor

Yes, i use the same raster for the input and the Cell size is not change.

In fact i know the CutFill tool is calculate volume base on the different between 2 surface, so i try to flatten the surface and then use it with the original one. Am i wrong ? 

Or we have another way to work with CutFill tool ? 

0 Kudos
DanPatterson_Retired
MVP Emeritus

The help topic links describe the methodology, anything deviating that will potentially produce unexpected results as you have found

0 Kudos
neolab
by
New Contributor

I see,

But it doesn't concern on how to produce the in_after_surface and i'm in trouble with it. As my research

Create TIN from points feature willl fill the hole with Tin triangles - spanning the gap – making a generally very flat surface 

And convert Tin back to raster which should return a new DEM with again the flatten and tilted surface 

So we can use it as the in_after_surface to make the CutFill tool work.

You have any idea about how to flatten the surface Mr Patterson?

0 Kudos
DanPatterson_Retired
MVP Emeritus

If the hole were a complete void, then the tin might work, but in reality, it would simply give a tin representation of the hole.  If you can convert the hole to a mask, then you examine Nibble to fill the hole with the surrounding values

0 Kudos
neolab
by
New Contributor

Thank you very much Mr Patterson,

So if in case my surface contains not only holes but also some dune, do we have another method to produce the in_after_surface that can be use in CutFill tools?

0 Kudos
DanPatterson_Retired
MVP Emeritus

sounds like you have an area that you want to have certain elevation characteristics... the easiest method is to delineate the area, convert it to a raster and use a Con function to assign the original elevations outside the area and the area within to whatever you want.  ArcMap isn't amenable to bulldozing or smoothing terrain out you might have better luck using cad-based tools that are used in pits and quarries or to show the before/after plans for road excavation and the like.

0 Kudos