This document is archived and information here might be outdated. Recommended version. |
Provides access to properties and methods on a Geoprocessing helper object.
Name | Description | |
---|---|---|
AddToolbox | Adds a reference to the specified toolbox to the GeoProcessor. | |
EnvironmentManager | The environment manager object associated with the helper. | |
Execute | Executes the specified tool. | |
GetParameterName | Get the parameter name for a given tool and index. | |
RemoveToolbox | Removes the reference to the specified toolbox from the GeoProcessor. |
Classes | Description |
---|---|
GpDispatch | Utility object used to execute geoprocessing tools. |
The IGPComHelper interface provides access to the properties and methods of the GPComHelper object. It is mainly intended for C++ developers to easily execute geoprocessing functions. Use this interface to invoke/create a GPEnvironmentManager object. With ArcGIS 9.2, C++ developers are now recommended to use the new Geoprocessor class.
See also IGeoprocessor
The following C ++ code sample shows how to execute a geoprocessing tool using the GPCOMHelper object with ArcGIS 9.0 and ArcGIS 9.1. With ArcGIS 9.2, it is recommended to use the Geoprocessor object.
//Create required objects
IGPComHelperPtr ipComHelper(CLSID_GpDispatch);
IPropertySetPtr ipPropertySet(CLSID_PropertySet);
ITrackCancelPtr ipTrackCancel(CLSID_CancelTracker);
IGPMessagesPtr ipMessages;
//Set the parameter values
//Input Value
VARIANT input;
input.vt = VT_BSTR;
input.bstrVal = ::SysAllocString(L"C:\\workspace\\near1.shp");
//Output Value
VARIANT output;
output.vt = VT_BSTR;
output.bstrVal = ::SysAllocString(L"C:\\workspace\\xbuf.shp");
//Buffer Distance Value
VARIANT dist;
dist.vt = VT_BSTR;
dist.bstrVal = ::SysAllocString(L"100");
ipPropertySet->SetProperty(L"in_features", input);
ipPropertySet->SetProperty(L"out_feature_class", output);
ipPropertySet->SetProperty(L"buffer_distance_or_field", dist);
//Add the Toolbox
ipComHelper->AddToolbox(L"C:\\ArcGIS\\ArcToolbox\\Toolboxes\\Analysis Tools.tbx");
//Execute the tool
ipComHelper->Execute(L"buffer_analysis", ipPropertySet, ipTrackCancel, &ipMessages);