AnsweredAssumed Answered

ADD XY Coordinates syntax assist

Question asked by tomas1 on Jul 24, 2020
Latest reply on Jul 27, 2020 by tomas1

I hesitate to submit this, as the syntax for calling this geoprocessing tool from the Pro SDK would seem straight forward.  The geoprocessing tool in Pro only appears to require an input feature layer to run.  I have successfully navigated calling many other geoprocessing tools much more involved than this, so I did not anticipate any heartburn with this one.


However, I have not been able to have it successfully execute.  I am using the same basic pattern as with other geoprocessing tools. I have tried many versions of this pattern, assigning values to the env array and trying different values for the arguments (strings of paths to the feature class, output feature layers, etc) with no luck.  The feature layer passed in is a point feature class in a file geodatabase.  I can successfully run the tool in native pro on the feature layer with success.


public Task<IGPResult> AddXYCoordinate4(FeatureLayer featureLayer)
    var AddXY = @"C:\Program Files\ArcGIS\Pro\Resources\ArcToolBox\Toolboxes\Data Management Tools.tbx\Add XY Coordinates";
    var args = Geoprocessing.MakeValueArray(featureLayer);
    var env = Geoprocessing.MakeEnvironmentArray();
    return Geoprocessing.ExecuteToolAsync(AddXY, args, env, null, null, GPExecuteToolFlags.None);

I would appreciate it if anyone could kindly assist me with how this tool should be called.