Select to view content in your preferred language

Clip geoprocessing tool returns a full copy of source raster

411
1
Jump to solution
09-28-2023 11:43 AM
RussellSuter
Occasional Contributor

Hi.

I'm writing a tool for ArcGIS Pro 3.1 that is supposed to clip a rectangle from a raster layer using the management.Clip geoprocessing tool. 

var parameters = Geoprocessing.MakeValueArray(layer, envelope, output);
var result = Geoprocessing.ExecuteToolAsync("management.Clip", parameters, null, null, null, GPExecuteToolFlags.None);

The layer is a RasterLayer.  The envelope is a geometry.Extent from the OnSketchCompleteAsync in a custom selection tool.  The output is a .jp2 or .tif output file.

What ends up in the output is a complete copy of the original raster layer instead of the contents of the clipped rectangle.  What am I doing wrong?

0 Kudos
1 Solution

Accepted Solutions
GKmieliauskas
Esri Regular Contributor

Hi,

One of your geoprocessing tool parameters doesn't match your requirement. Add clipping_geometry parameter with value "NONE". Default value is "ClippingGeometry".

var parameters = Geoprocessing.MakeValueArray(layer, envelope, output, "", "", "NONE");
var result = Geoprocessing.ExecuteToolAsync("management.Clip", parameters, null, null, null, GPExecuteToolFlags.None);

 

More info here

 

View solution in original post

0 Kudos
1 Reply
GKmieliauskas
Esri Regular Contributor

Hi,

One of your geoprocessing tool parameters doesn't match your requirement. Add clipping_geometry parameter with value "NONE". Default value is "ClippingGeometry".

var parameters = Geoprocessing.MakeValueArray(layer, envelope, output, "", "", "NONE");
var result = Geoprocessing.ExecuteToolAsync("management.Clip", parameters, null, null, null, GPExecuteToolFlags.None);

 

More info here

 

0 Kudos