<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Geoprocessing tool in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/geoprocessing-tool/m-p/1110022#M7263</link>
    <description>&lt;P&gt;I'm curious about the use of "ConfigureAwait(false)"....are u trying to change the synchronization context from the QueuedTask? FWIW QueuedTask It is a single thread _by design_......if you remove that statement what happens?&lt;/P&gt;</description>
    <pubDate>Thu, 21 Oct 2021 22:38:39 GMT</pubDate>
    <dc:creator>CharlesMacleod</dc:creator>
    <dc:date>2021-10-21T22:38:39Z</dc:date>
    <item>
      <title>Geoprocessing tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/geoprocessing-tool/m-p/1109553#M7259</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;could anyone tell me just looking at the code where could there be a bug? The original code that I managed was functional, but I wanted to simplify the code even more, and it no longer works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt; protected override async void OnClick()
        {
            FeatureLayer fl = MapView.Active.Map.FindLayers("O_Klad_ZTM10").First() as FeatureLayer;
            if (fl == null)
                return;
            await QueuedTask.Run(() =&amp;gt;
            {
                QueryFilter qf = new QueryFilter();
                string whereClause = "ZTM10_nom LIKE '0602%'";
                qf.WhereClause = whereClause;
                fl.Select(qf);
            });
            var path = @"D:\PomocnaVrstva.shp";
            var extent = 200;
            // CalculateBuffer(fl, path, extent, "Meters");

            object[] listParameter = {fl, path, extent, "Meters"};
            await StartGp("analysis.Buffer", listParameter);
            int indexNumber = 0;
            var mapView = MapView.Active;
            if (mapView != null)
            {
                Uri shpUri = new Uri(path);
                await QueuedTask.Run(async ()=&amp;gt;//from here it no longer takes place
                {
                    Layer shapeLayer = LayerFactory.Instance.CreateLayer(
                        shpUri, mapView.Map, indexNumber, "PomocnaVrstva");
                    // var selectedLayer = mapView.GetSelectedLayers()[0] as FeatureLayer; není potřeba
                    var shpLayer = shapeLayer as FeatureLayer;
                    var pathDis = @"D:\DissolvePomocnaVrstva";
                    //// DissolveLayer(shpLayer, pathDis);
                    object[] listOfPara = {shpLayer, pathDis};
                    await StartGp("management.Dissolve", listOfPara);
                    FeatureLayer dissFeat = MapView.Active.Map.FindLayers("DissolvePomocnaVrstva").First() as FeatureLayer;
                    var overlapType = "COMPLETELY_WITHIN";
                    var selectionType = "NEW_SELECTION";
                    var pathErase = @"D:\ErasePomocnaVrstva";
                    //SelectLayer(featLayer, overlapType, dissFeat, selectionType);
                    FeatureLayer featLayer = MapView.Active.Map.FindLayers("O_Klad_ZTM50").First() as FeatureLayer;
                    object[] listOfParameter = { featLayer, overlapType, dissFeat, selectionType };
                    await StartGp("management.SelectLayerByLocation", listOfParameter);
                    //EraseLayer(dissFeat, featLayer, pathErase);
                    object[] parameterList = { dissFeat, featLayer, pathErase };
                    await StartGp("analysis.Erase", parameterList);
                });
            }
        }

        private static async Task StartGp(string funcArc, object parame)
        {
            var parameters = Geoprocessing.MakeValueArray(parame);
           FunctionPart(funcArc, parameters);

        }
        //private static void CalculateBuffer(FeatureLayer featureLayer, string sOutputPath, double dDistance, string sUnits)
        //{
        //    var parameters = Geoprocessing.MakeValueArray(featureLayer, sOutputPath,
        //        string.Format(CultureInfo.InvariantCulture, "{0} {1}", dDistance, sUnits));
        //    var buffer = "analysis.Buffer";
        //    FunctionPart(buffer, parameters);
        //}
        //private static void DissolveLayer(FeatureLayer featureLayer, string sOutputPath)
        //{
        //    var parameters = Geoprocessing.MakeValueArray(featureLayer, sOutputPath);
        //    var dissolve = "management.Dissolve";
        //    FunctionPart(dissolve, parameters);
        //}
        //private static void EraseLayer(FeatureLayer featureLayer, FeatureLayer eraseFeatureLayer, string sOutputPath)
        //{
        //    var parameters = Geoprocessing.MakeValueArray(featureLayer, eraseFeatureLayer, sOutputPath);
        //    var erase = "analysis.Erase";
        //    FunctionPart(erase, parameters);
        //}
        //private static void SelectLayer(FeatureLayer featureLayer, string overlapType, FeatureLayer selectFeature, string selectionType)
        //{
        //    var parameters = Geoprocessing.MakeValueArray(featureLayer, overlapType, selectFeature, selectionType);
        //    var selectLayer = "management.SelectLayerByLocation";
        //    FunctionPart(selectLayer, parameters);
        //}

        private static async Task FunctionPart(string stringFunc, IReadOnlyList&amp;lt;string&amp;gt; parameters)
        {
            try
            {
                await Geoprocessing.ExecuteToolAsync(stringFunc, parameters).ConfigureAwait(false);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString(), Assembly.GetExecutingAssembly().FullName);
                throw;
            }
        }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will be very grateful for every idea.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 06:36:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/geoprocessing-tool/m-p/1109553#M7259</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2021-10-21T06:36:11Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/geoprocessing-tool/m-p/1109653#M7260</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/506017"&gt;@DavidMrázek&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When you run this code, what error do you get?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 12:44:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/geoprocessing-tool/m-p/1109653#M7260</guid>
      <dc:creator>ABishop</dc:creator>
      <dc:date>2021-10-21T12:44:29Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/geoprocessing-tool/m-p/1110022#M7263</link>
      <description>&lt;P&gt;I'm curious about the use of "ConfigureAwait(false)"....are u trying to change the synchronization context from the QueuedTask? FWIW QueuedTask It is a single thread _by design_......if you remove that statement what happens?&lt;/P&gt;</description>
      <pubDate>Thu, 21 Oct 2021 22:38:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/geoprocessing-tool/m-p/1110022#M7263</guid>
      <dc:creator>CharlesMacleod</dc:creator>
      <dc:date>2021-10-21T22:38:39Z</dc:date>
    </item>
    <item>
      <title>Re: Geoprocessing tool</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/geoprocessing-tool/m-p/1110112#M7264</link>
      <description>&lt;P&gt;There were three mistakes and terribly unnecessary:&lt;BR /&gt;1. suffix at path to files&lt;BR /&gt;2. u buffer should be input conditions three, I wrote two and that is the size of the clip and the unit separately&lt;BR /&gt;3. object list is different than parameter in StartGp (object [] and object)&lt;/P&gt;</description>
      <pubDate>Fri, 22 Oct 2021 05:03:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/geoprocessing-tool/m-p/1110112#M7264</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2021-10-22T05:03:51Z</dc:date>
    </item>
  </channel>
</rss>

