Has anyone used reclassify in a C# program

489
2
08-26-2019 10:53 AM
SamRideout1
New Contributor III

I am trying to automate a process and need to perform a reclassify using visual studio and C#.  Looking for anyone who has done this successfully and possibly some source code to perform the operation.

Tags (1)
0 Kudos
2 Replies
GKmieliauskas
Esri Regular Contributor

Hi Sam,

I use raster reclassify from geoprocessing. Below is part of code:

// out_raster = arcpy.sa.Reclassify("density1000", "VALUE", "2000 1;100000 2", "DATA");

var parameters = Geoprocessing.MakeValueArray(sDlRaster, "VALUE", sReclassString, sOutRaster);

var environments = Geoprocessing.MakeEnvironmentArray(workspace: sWorkspace);

var gpResult = Geoprocessing.ExecuteToolAsync("Reclassify_sa", parameters, environments,

CancelableProgressor.None, GPExecuteToolFlags.AddToHistory);

gpResult.Wait();

You can execute every geoprocessing function you need. Get from executed command report python script ant then using python script syntax arrange your parameters in c# code. First commented line in my code is python script line.  I do it in that way because all information about geoprocessing functions and samples are in python.

SamRideout1
New Contributor III

Thank you Gintautas.....  I greatly appreciate your answer.  I have tried it out and it works great.  

0 Kudos