Different outputs from Clip_management and ExtractByMask

325
1
04-08-2018 02:01 AM
Duy_PhuongTa
New Contributor

I have a question about clipping a part from a raster according to the extent of a polygon. Should Clip_management and ExtractByMask create the same results if I set the "NO_MAINTAIN_EXTENT" option for Clip and the "snapRaster" option for Extract by Mask (to avoid any resampling)?

arcpy.Clip_management(raster, "#", outraster, "in_memory\shape_lyr", "-9999", "ClippingGeometry",
 "NO_MAINTAIN_EXTENT")

vs

arcpy.env.snapRaster = raster outExtractByMask = ExtractByMask(raster, "in_memory\shape_lyr")outExtractByMask.save(outraster)

If yes, why my two outputs still differ? See photo:

Results

I can analyse that the method: Clip_management produced 3 values more than ExtractByMask(comparing two attribute tables).

Any ideas?

I just found one of the 3 pixels, that was made by using Clip_management but not ExtractByMask. It's driving me crazy. The red one was created using <code>Clip_management</code>

Im using ArcGis 10.4.1. After a long time having no answer, I decided for myself that Extract By Mask is more accurate than Clip management. Is it true?

0 Kudos
1 Reply
DanPatterson_Retired
MVP Emeritus

Extract by Mask...

Was a feature used as your mask?

When the input mask is feature data, cells in the input raster whose center falls within the perimeter of the feature will be included in the output, while cells whose center falls outside it will receive NoData.

Clip (raster) ... uses the extent and any cell that intersects

This tool allows you to extract a portion of a raster dataset based on a template extent. The clip output includes any pixels that intersect the template extent.

They are different in their purpose and bounds

0 Kudos