1

Currently i have the output of Pix4D which contains: DSM, DTM, LAS file. I want to calculate the volume of a polygon specified by coordinate. Here is the script i'm using right now:

        arcpy.FeatureToRaster_conversion(Polygon_Layer, "FID", poly_mask, Cellsize)

        #Convert Poly verticies to points, extract raster value to poly points, convert poly to raster
        poly_boundaries = "p_boundaries.shp"
        arcpy.FeatureVerticesToPoints_management(Polygon_Layer, poly_boundaries, "ALL")
        #arcpy.AddMessage("Extracting elevation values from elevation raster...")
        poly_boundaries_elevation = "p_boundaries_elevation.shp"
        ExtractValuesToPoints(poly_boundaries, Elevation_Raster, poly_boundaries_elevation, "NONE", "VALUE_ONLY")

        #converts raster with elevation points to a TIN. 
        tin_parameter = poly_boundaries_elevation + " RASTERVALU masspoints"
        poly_tin = "poly_tin"
        arcpy.CreateTin_3d(poly_tin, sr, tin_parameter, "DELAUNAY")

        #Tin to raster
        TinRastCellSize = "CELLSIZE " + Cellsize
        cap_raster = "cap_raster"
        arcpy.TinRaster_3d(poly_tin, cap_raster, "FLOAT", "", TinRastCellSize, "")

        #calculates volume above raster, adds output to the poly shp
        outCutFill = CutFill(clipped_raster, cap_raster, 1)
        temporary_cut_fill = "cutfill.tif"
        outCutFill.save(temporary_cut_fill)

The raster i used in this script is DSM. I use DroneDeploy.com to recheck my result, but the problem is that:

  • If my polygon contains small feature such as: hole, building then my result is quite similar to DroneDeploy

  • But if my polygon is big and contains buiding, tree, hole etc then just Fill volume is correct and Cut volume is not similar to DroneDeploy result.

I have tried to changed to using DTM but the result is not correct. Can you guys show me what's wrong with my script?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.