<?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: I need help with GeoprocessingTask and Elevation Profile! in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/i-need-help-with-geoprocessingtask-and-elevation/m-p/1587912#M13323</link>
    <description>&lt;P&gt;Several results:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndreyTsar_1-1740140630003.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/125950i97F5565EA8FC66DE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndreyTsar_1-1740140630003.png" alt="AndreyTsar_1-1740140630003.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndreyTsar_2-1740140650662.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/125951i89827CFF3DF73887/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndreyTsar_2-1740140650662.png" alt="AndreyTsar_2-1740140650662.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndreyTsar_3-1740140687374.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/125952i84FD48C1F7D00BA5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndreyTsar_3-1740140687374.png" alt="AndreyTsar_3-1740140687374.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 21 Feb 2025 12:25:38 GMT</pubDate>
    <dc:creator>AndreyTsar</dc:creator>
    <dc:date>2025-02-21T12:25:38Z</dc:date>
    <item>
      <title>I need help with GeoprocessingTask and Elevation Profile!</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/i-need-help-with-geoprocessingtask-and-elevation/m-p/1587496#M13305</link>
      <description>&lt;P&gt;I couldn't fully figure out GeoprocessingTask and the Elevation Profile.&amp;nbsp; Help me understand why outputFeatures.CanGetOutputFeatures is always false?&amp;nbsp;My code:&lt;/P&gt;&lt;P&gt;var _elevationServiceUrl = new Uri("&lt;A href="https://elevation.arcgis.com/arcgis/rest/services/Tools/ElevationSync/GPServer/Profile" target="_blank"&gt;https://elevation.arcgis.com/arcgis/rest/services/Tools/ElevationSync/GPServer/Profile&lt;/A&gt;");&lt;BR /&gt;var geoprocessingTask = await GeoprocessingTask.CreateAsync(_elevationServiceUrl);&lt;/P&gt;&lt;P&gt;var fields = new List&amp;lt;Field&amp;gt;&lt;BR /&gt;{&lt;/P&gt;&lt;P&gt;};&lt;/P&gt;&lt;P&gt;var featureTable = new FeatureCollectionTable(fields, GeometryType.Polyline, SpatialReferences.Wgs84);&lt;BR /&gt;var feature = featureTable.CreateFeature();&lt;BR /&gt;feature.Geometry = polyline;&lt;BR /&gt;await featureTable.AddFeatureAsync(feature);&lt;/P&gt;&lt;P&gt;var parameters = await geoprocessingTask.CreateDefaultParametersAsync();&lt;BR /&gt;parameters.Inputs["InputLineFeatures"] = new GeoprocessingFeatures(featureTable);&lt;BR /&gt;parameters.Inputs["DEMResolution"] = new GeoprocessingString("FINEST");&lt;BR /&gt;parameters.Inputs["MaximumSampleDistance"] = new GeoprocessingDouble(200);&lt;/P&gt;&lt;P&gt;parameters.ReturnM = true;&lt;BR /&gt;parameters.ReturnZ = true;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;var job = geoprocessingTask.CreateJob(parameters);&lt;BR /&gt;var result = await job.GetResultAsync();&lt;/P&gt;&lt;P&gt;if (result.Outputs.ContainsKey("OutputProfile"))&lt;BR /&gt;{&lt;BR /&gt;var outputFeatures = result.Outputs["OutputProfile"] as GeoprocessingFeatures;&lt;/P&gt;&lt;P&gt;if (outputFeatures != null &amp;amp;&amp;amp; outputFeatures.CanGetOutputFeatures)&lt;BR /&gt;{&lt;BR /&gt;var featureSet = await outputFeatures.GetOutputFeaturesAsync();&lt;BR /&gt;foreach (var outputFeature in featureSet)&lt;BR /&gt;{&lt;BR /&gt;var geometry = outputFeature.Geometry as Polyline;&lt;BR /&gt;// Подальша обробка геометрії&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;MessageBox.Show("Помилка: OutputProfile не містить даних або не підтримує отримання результатів.");&lt;BR /&gt;}&lt;BR /&gt;}&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 20 Feb 2025 15:02:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/i-need-help-with-geoprocessingtask-and-elevation/m-p/1587496#M13305</guid>
      <dc:creator>AndreyTsar</dc:creator>
      <dc:date>2025-02-20T15:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: I need help with GeoprocessingTask and Elevation Profile!</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/i-need-help-with-geoprocessingtask-and-elevation/m-p/1587832#M13320</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;As I understand from &lt;A href="https://developers.arcgis.com/net/api-reference/api/net/Esri.ArcGISRuntime/Esri.ArcGISRuntime.Tasks.Geoprocessing.GeoprocessingFeatures.CanGetOutputFeatures.html#Esri_ArcGISRuntime_Tasks_Geoprocessing_GeoprocessingFeatures_CanGetOutputFeatures" target="_self"&gt;API reference&lt;/A&gt;, it must be like that:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;IFeatureSet featureSet;   
if (outputFeatures.CanGetOutputFeatures)
    featureSet = await outputFeatures.GetOutputFeaturesAsync();
else
    featureSet = outputFeatures.Features ;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 06:39:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/i-need-help-with-geoprocessingtask-and-elevation/m-p/1587832#M13320</guid>
      <dc:creator>GKmieliauskas</dc:creator>
      <dc:date>2025-02-21T06:39:31Z</dc:date>
    </item>
    <item>
      <title>Re: I need help with GeoprocessingTask and Elevation Profile!</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/i-need-help-with-geoprocessingtask-and-elevation/m-p/1587835#M13321</link>
      <description>&lt;P&gt;I really appreciate your response.This check should work&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 06:42:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/i-need-help-with-geoprocessingtask-and-elevation/m-p/1587835#M13321</guid>
      <dc:creator>AndreyTsar</dc:creator>
      <dc:date>2025-02-21T06:42:22Z</dc:date>
    </item>
    <item>
      <title>Re: I need help with GeoprocessingTask and Elevation Profile!</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/i-need-help-with-geoprocessingtask-and-elevation/m-p/1587850#M13322</link>
      <description>&lt;P&gt;My final code:&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;        public async Task&amp;lt;List&amp;lt;MapPoint&amp;gt;?&amp;gt; GetElevationProfile(Polyline polyline)
        {
            List&amp;lt;MapPoint&amp;gt; resultPoints = new();

            var _elevationServiceUrl = new Uri("https://elevation.arcgis.com/arcgis/rest/services/Tools/ElevationSync/GPServer/Profile");
            var geoprocessingTask = await GeoprocessingTask.CreateAsync(_elevationServiceUrl);
            var featureTable = new FeatureCollectionTable(new List&amp;lt;Field&amp;gt;(), GeometryType.Polyline, polyline.SpatialReference);
            var feature = featureTable.CreateFeature();
            feature.Geometry = polyline;

            await featureTable.AddFeatureAsync(feature);

            var parameters = await geoprocessingTask.CreateDefaultParametersAsync();
            parameters.Inputs.Add("InputLineFeatures", new GeoprocessingFeatures(featureTable));
            parameters.Inputs.Add("DEMResolution", new GeoprocessingString("FINEST"));
            parameters.Inputs.Add("MaximumSampleDistance", new GeoprocessingDouble(200));
            parameters.OutputSpatialReference = SpatialReferences.Wgs84;
            parameters.ReturnM = false;
            parameters.ReturnZ = true;

            try
            {
                var job = geoprocessingTask.CreateJob(parameters);
                var result = await job.GetResultAsync();

                if (result?.Outputs?.ContainsKey("OutputProfile") == true)
                {
                    var outputFeatures = result.Outputs["OutputProfile"] as GeoprocessingFeatures;
                    if (outputFeatures != null)
                    {
                        IFeatureSet? featureSet = outputFeatures!.CanGetOutputFeatures ? await outputFeatures!.GetOutputFeaturesAsync() : outputFeatures!.Features;
                        if (featureSet != null)
                            foreach (var outputFeature in featureSet)
                            {
                                if (outputFeature?.Geometry?.GeometryType == GeometryType.Polyline)
                                {
                                    var poly = outputFeature.Geometry as Polyline;
                                    var points = poly?.Parts.SelectMany(x =&amp;gt; x.Points);
                                    if (points != null) resultPoints.AddRange(points);
                                }
                            }
                        return resultPoints;
                    }
                    else MessageBox.Show("Помилка: OutputProfile не містить даних або не підтримує отримання результатів.");
                }
                else MessageBox.Show("Помилка: GetResultAsync не містить даних");
            }
            catch
            {
                MessageBox.Show("Помилка: OutputProfile не містить даних або не підтримує отримання результатів.");
            }
            return null;
        }&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 21 Feb 2025 07:23:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/i-need-help-with-geoprocessingtask-and-elevation/m-p/1587850#M13322</guid>
      <dc:creator>AndreyTsar</dc:creator>
      <dc:date>2025-02-21T07:23:01Z</dc:date>
    </item>
    <item>
      <title>Re: I need help with GeoprocessingTask and Elevation Profile!</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/i-need-help-with-geoprocessingtask-and-elevation/m-p/1587912#M13323</link>
      <description>&lt;P&gt;Several results:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndreyTsar_1-1740140630003.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/125950i97F5565EA8FC66DE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndreyTsar_1-1740140630003.png" alt="AndreyTsar_1-1740140630003.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndreyTsar_2-1740140650662.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/125951i89827CFF3DF73887/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndreyTsar_2-1740140650662.png" alt="AndreyTsar_2-1740140650662.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AndreyTsar_3-1740140687374.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/125952i84FD48C1F7D00BA5/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AndreyTsar_3-1740140687374.png" alt="AndreyTsar_3-1740140687374.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV class=""&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 21 Feb 2025 12:25:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/i-need-help-with-geoprocessingtask-and-elevation/m-p/1587912#M13323</guid>
      <dc:creator>AndreyTsar</dc:creator>
      <dc:date>2025-02-21T12:25:38Z</dc:date>
    </item>
  </channel>
</rss>

