Geoprocessing Vs Geoprocessor: Best practice, when to use, best suited for, etc.

2264
3
08-20-2012 12:34 PM
JohnJackson
New Contributor
I am a bit confused regarding the components of ESRI.ArcGIS.Geoprocessor and ESRI.ArcGIS.Geoprocessing.  Is there a specific use each lends itself to (ex: better for custom tools or stand alone apps)?  Is there a best practice for when to use which?  I am currently working on a stand alone WPF / C# application where the geoprocessing takes place in a thread without any specific user interaction. Is one of these assemblies better suited than the other for that type of environment?

Thanks for your input,
John
0 Kudos
3 Replies
NeilClemmons
Regular Contributor III
I forget which is which, but one is the old geoprocessor class and is still provided for compatibility with previous versions.  The one you should be using for new code is the one in which you create an instance of the geoprocessing tool you want to use, set the parameters by accessing properties on that class and then pass the instance of that class into the geoprocessor's Execute method.  The old way requires you to fill a property set with the parameters then pass the name of the geoprocessing tool as a string into the Execute method along with the property set.
0 Kudos
LeoDonahue
Occasional Contributor III
I can tell you that in the AO Java API, these classes have useful side effects.

com.esri.arcgis.geoprocessing.GeoProcessor;
com.esri.arcgis.geoprocessing.tools.datamanagementtools.Append;
com.esri.arcgis.geoprocessing.tools.datamanagementtools.DeleteFeatures;

Executing the Append and DeleteFeatures tools will update the TOC and refresh the active view, assuming you're working with add-ins, so make sure you are not calling refresh again somewhere else in your logic.
0 Kudos
JohnJackson
New Contributor
I forget which is which, but one is the old geoprocessor class and is still provided for compatibility with previous versions.  The one you should be using for new code is the one in which you create an instance of the geoprocessing tool you want to use, set the parameters by accessing properties on that class and then pass the instance of that class into the geoprocessor's Execute method.  The old way requires you to fill a property set with the parameters then pass the name of the geoprocessing tool as a string into the Execute method along with the property set.


That makes sense Neil. Thanks!  I suspected one of the assemblies might be for backward compatibility. The Geoprocessor assembly has the tool <-> class mapping.
0 Kudos