Frequently asked question

How do I run Business Analyst tools using ArcGIS Pro .NET SDK with a specific datasource?

Last Published: April 25, 2020

Answer

Even though the baDataSource Environment Variable is not supported by MakeEnvironmentArray method, it can be can passed to ExecuteToolAsync. To do this, just create a list of key-value pairs, for example:

  protected override void OnClick()
    {
      var parameters = Geoprocessing.MakeValueArray("populationtotals.totpop_cy", "2019 Total Population Layer Local", "NATURAL_BREAKS", "5");

      var env = new List>() { new KeyValuePair("baDataSource", "LOCAL;;USA_ESRI_2019") };

      var gp_result = Geoprocessing.ExecuteToolAsync("ba.ColorCodedLayer", parameters, env, flags:GPExecuteToolFlags.AddToHistory | GPExecuteToolFlags.AddOutputsToMap);

      parameters = Geoprocessing.MakeValueArray("populationtotals.totpop_cy", "2019 Total Population Layer Online", "NATURAL_BREAKS", "5");

      env = new List>() { new KeyValuePair("baDataSource", "ONLINE;US;") };

      gp_result = Geoprocessing.ExecuteToolAsync("ba.ColorCodedLayer", parameters, env, flags: GPExecuteToolFlags.AddToHistory | GPExecuteToolFlags.AddOutputsToMap);

Article ID:000023131

Software:
  • ArcGIS Pro SDK for Microsoft NET
  • More Products

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options