5

I need to dissolve a feature class based on two fields for the dissolve_field parameter and two fields for the statistics_fields parameter. Does anyone have an example of how to do this using C#?

The code I'm using works if I only pass in a single field for the dissolve_field parameter:

ESRI.ArcGIS.DataManagementTools.Dissolve dissolve = new ESRI.ArcGIS.DataManagementTools.Dissolve();

//Set parameters values  
dissolve.in_features = "... path to feature class to dissolve ...";  
dissolve.dissolve_field = "Field1, Field2";  
dissolve.statistics_fields = "[NumberField1,MIN],[NumberField2,MAX]";  
dissolve.multi_part = "MULTI_PART";  
dissolve.unsplit_lines = "UNSPLIT_LINES";  
dissolve.out_feature_class = "... path to the output feature class ...";  

// Dissolve the feature class  
Geoprocessor geoprocessor = new Geoprocessor();  
object result = geoprocessor.Execute(dissolve, null); 
3
  • Try putting the field list inside square brackets. "[Field1, Field2]"
    – nef001
    Feb 11, 2017 at 0:19
  • I tried your suggestion, but I continue to get the following error:
    – Dave F
    Feb 11, 2017 at 1:41
  • Error HRESULT E_FAIL has been returned from a call to a COM component.
    – Dave F
    Feb 11, 2017 at 1:42

1 Answer 1

0

The parameters that ended up working are:

dissolve.dissolve_field = "Field1;Field2";  
dissolve.statistics_fields = "NumberField1 MIN;NumberField2 MAX";  

Which was a slightly different syntax that what is in the ESRI documentation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.