Frequently asked question

What are the changes in the ESRI.ArcGIS.Geoprocessor assembly in ArcGIS 9.2 Service Pack 3?

Last Published: April 25, 2020

Answer

ArcGIS 9.2 includes a new .NET assembly called the ESRI.ArcGIS.Geoprocessor. This assembly contains a managed class called the Geoprocessor. Each toolbox provided by ESRI is also represented by a managed assembly. In each toolbox assembly there are classes representing each geoprocessing tool. Tool classes are used to set up and run a tool with the Geoprocessor.

Prior to Service Pack 3 for ArcGIS 9.2, the software had a bug with any .NET tool class containing a property that represented a Boolean parameter. The tool to be executed expects a string representing a valid keyword rather than 'true' or 'false'. For instance, the values for the Location property on the Near class are 'LOCATION' and 'NO_LOCATION'. Since the property type was Boolean, only 'true' or 'false' could be set. The result was that the tool failed to execute, displaying the error message, "The input parameter to location is not within the domain."

The workaround was to execute the tool by name using a Variant Array as shown here:

Code:
// Initialize the Geoprocessor
Geoprocessor GP = new Geoprocessor();


// Generate the array of parameters.
IVariantArray parameters = new VarArrayClass();
parameters.Add(@"C:\redlands.mdb\allInOneWGS84\control_WGS84");
parameters.Add(@"C:\redlands.mdb\rdlsControl\control");
parameters.Add("500 METTER");
parameters.Add("LOCATION");

// Execute Near by name.
GP.Execute("Near", parameters, null);

if (GP.MessageCount > 0)
{
for (int Count = 0; Count <= GP.MessageCount - 1; Count++)
{
Console.WriteLine(GP.GetMessage(Count));
}
}

Some tools allowed the user to enter 'false' as the property value and the code compiled successfully, such as Feature Class To Coverage. In ArcGIS 9.2 Service Pack 3, the fix required the keyword for all Boolean parameters. If a user sets 'false' as the property value, the .NET program fails to compile. In this situation, previously compiled code results in a runtime error. The valid code for Service Pack 3 is now written like this:
Code:
// Initialize the Geoprocessor
Geoprocessor GP = new Geoprocessor();

// Initialize the Near tool
Near neartool = new Near();
neartool.input_features = (@"C:\redlands.mdb\allInOneWGS84\control_WGS84");
neartool.near_features = (@"C:\redlands.mdb\rdlsControl\control");
neartool.search_radius = "500 METERS";
neartool.Location = "LOCATION";
GP.Execute(neartool, null):

Article ID:000009514

Software:
  • ArcGIS Server

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Related Information

Discover more on this topic