Hello,
how to write statisticsFields in managment Dissolve correctly?
I tried it like this:
object[] sumArea = { "Shape_Area", "SUM" };
object[] sumLenght = { "Shape_Length", "SUM" };
object[] statisticsFields = { sumArea, sumLenght };
object[] listOfPara = { shpLayer, file, dissolveFields, statisticsFields, "MULTI_PART", "DISSOLVE_LINES" };
//second
object[] statisticsFields = { "Shape_Area", "SUM" ,"Shape_Length", "SUM"}
object[] listOfPara = { shpLayer, file, dissolveFields, statisticsFields, "MULTI_PART", "DISSOLVE_LINES" };
Both without success.
I will be happy for any advice.
Thank you in advance
David
Solved! Go to Solution.
Hi,
Have you tried like this:
string statisticsFields = "Shape_Length SUM;Shape_Area SUM";
var parameters = Geoprocessing.MakeValueArray(shpLayer, file, dissolveFields, statisticsFields, "MULTI_PART", "DISSOLVE_LINES");
var gpResult = Geoprocessing.ExecuteToolAsync("Dissolve_management", parameters, null, CancelableProgressor.None, GPExecuteToolFlags.None);
You have this published in the ArcGIS Pro space, hence, use python
Dissolve (Data Management)—ArcGIS Pro | Documentation
If this is for the Pro SDK I will move it
That's what I did. But I don't know how to rewrite it in C#. Yes, it is for the ProSDK.
The documentation shows the statistic fields added like [[field, {statistic_type}],...], so try this:
object[] statisticsFields = { "Shape_Area", {"SUM"} ,"Shape_Length", {"SUM"}}
I used statistics fields in an ArcMap app, and while the documentation showed the same format, my code was able to use them by adding them like "Shape_Area Sum". You might want to give that syntax a try.
Thank you for the advice, but it can't be rewritten like this.
Hi,
I would recommend to execute the same tool from ArcGIS Pro Geoprocessing pane. Then copy python script and check, how parameters looks in python script. For .NET there is no better way to get geoprocessing function parameters. Using Geoprocessing.MakeValueArray try to get the same or similar.
Hi,
yes I do exactly but I don't know how to rewrite it in c # but thank you for the advice
Hi,
Have you tried like this:
string statisticsFields = "Shape_Length SUM;Shape_Area SUM";
var parameters = Geoprocessing.MakeValueArray(shpLayer, file, dissolveFields, statisticsFields, "MULTI_PART", "DISSOLVE_LINES");
var gpResult = Geoprocessing.ExecuteToolAsync("Dissolve_management", parameters, null, CancelableProgressor.None, GPExecuteToolFlags.None);
Hi,
Yes that's it, thank you very much! It was enough to omit the comma and combine it into one text.