[GIS] Is Clip (Data management) or Extract By Mask (Spatial Analyst) more efficient

arcgis-desktopclipgeoprocessingmaskingspatial-analyst

I'm trying to clip down an Orthophoto to a county boundary. I've been using the Extract By Mask Tool, but this process has been running for about 12 hours! It's gone through 2 cycles already, so I'm assuming this is each band. Can someone correct me if I'm wrong on that.

Would the Clip in Data Management work better (faster)? How would the accuracy be?

I've always tried to use Extract By Mask, but this is taking too long.

Best Answer

I ran a test to determine how the speed and quality differs between the two methods, here are the results:

Input data

  1. 4-band NAIP DOQQ image in .img format (349.34MB)
  2. A feature class used as the mask/clipper

enter image description here

Performance

Three trials were performed and benchmarked. The Clip (Data Management) method is significantly faster than the Extract by Mask (Spatial Analyst) method.

enter image description here

Quality

Both extents were identical as were NoData values. However, a visual assessment showed that the extract by mask method slightly altered the pixel arrangement--likely the result of some type of resampling. The pixel arrangement in the clip operation were identical to the original input image.


# Import system modules
import arcpy, time, os
from arcpy import env
from arcpy.sa import *

env.overwriteOutput = 1

# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")

# Set local variables
inRaster = r'C:\temp\naip2011.img'
inMaskData = r'C:\temp\fgdb.gdb\clipper'
outws = r'C:\temp'
out1 = os.path.join(outws, 'extractbymask.img')
out2 = os.path.join(outws, 'clip.img')

#############TRIAL 1: EXTRACT BY MASK#########################################
start = time.clock()

# ExtractByMask
outExtractByMask = ExtractByMask(inRaster, inMaskData)

# Save the output
outExtractByMask.save(out1)

end = time.clock()
total = end - start

print "The extract by mask method took:  %s seconds" % round(total, 3)

###############TRIAL 2: CLIP#################################################
start = time.clock()

# Clip
arcpy.Clip_management(inRaster, "#", out2, inMaskData, "", "ClippingGeometry")

end = time.clock()
total = end - start

print "The clip method took:             %s seconds" % round(total, 3)
Related Question