<?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: How do I measure the line length of several elements? in ArcGIS Pro SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1082757#M6939</link>
    <description>&lt;P&gt;I attached a sample that is using a dockpane to show the selected [line] rows and the respective length.&amp;nbsp; Note that the length was computed using a area specific projection (in my case Hawaii), so you might want to change this to fit your needs.&amp;nbsp; When you click on a line in the grid the corresponding feature will flash on the map.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Wolf_0-1627321560965.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/19363i83748DD75AC59AA4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Wolf_0-1627321560965.png" alt="Wolf_0-1627321560965.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 26 Jul 2021 17:46:19 GMT</pubDate>
    <dc:creator>Wolf</dc:creator>
    <dc:date>2021-07-26T17:46:19Z</dc:date>
    <item>
      <title>How do I measure the line length of several elements?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1081642#M6908</link>
      <description>&lt;P&gt;Hello, I try to programmatically measure the length of several lines that are not in the same layer at the same time. After that I want to write the individual distances in the form (there is no problem with that ...). Unfortunately, I don't know how to write a method that would measure individual lines for me.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;What I have tried:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;namespace ProAppModule1
{


internal class Delka : Button
{

protected override void OnClick()
{
Form1 formular = new Form1();
double delka = new double();
var lyrs = MapView.Active.Map.GetLayersAsFlattenedList().OfType&amp;lt;FeatureLayer&amp;gt;();
MapView.Active.SelectLayers(lyrs.ToList());
var openTableBtnCmd = FrameworkApplication.GetPlugInWrapper("esri_editing_table_openTablePaneButton") as ICommand;
if (openTableBtnCmd != null)
{
openTableBtnCmd.Execute(null);
}


formular.richTextBox1.Text = delka.ToString();
formular.Show();
}
}
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sorry for the wrong explanation, I'll try better.&lt;/P&gt;&lt;P&gt;I described the individual things in the picture, and now my idea, I would like the individual lines to be measured after pressing the button and then write their lengths in the form (I already have it ready, this is not a problem).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Perhaps it is understandable and understandable.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I will be happy for any advice or help.&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 04:51:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1081642#M6908</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2021-07-23T04:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a specific column number in an attribute table?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1081803#M6911</link>
      <description>&lt;P&gt;I don't quite understand what your workflow is and why you are opening the attribute table.&amp;nbsp; Can you show a screenshot of what you're trying to show?&amp;nbsp; Are you computing something based on an attribute column's value?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Jul 2021 16:18:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1081803#M6911</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-07-22T16:18:22Z</dc:date>
    </item>
    <item>
      <title>Re: How to read a specific column number in an attribute table?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1082054#M6923</link>
      <description>&lt;P&gt;I tried to adjust it so maybe it's better.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 04:52:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1082054#M6923</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2021-07-23T04:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: How do I measure the line length of several elements?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1082248#M6928</link>
      <description>&lt;P&gt;I think I see your desired workflow now, i will try to find some matching samples over the weekend.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Jul 2021 16:49:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1082248#M6928</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-07-23T16:49:31Z</dc:date>
    </item>
    <item>
      <title>Re: How do I measure the line length of several elements?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1082609#M6936</link>
      <description>&lt;P&gt;Hello Wolf,&lt;/P&gt;&lt;P&gt;I hate to bother you, but haven't found any examples or anything about my project?&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 06:08:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1082609#M6936</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2021-07-26T06:08:29Z</dc:date>
    </item>
    <item>
      <title>Re: How do I measure the line length of several elements?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1082757#M6939</link>
      <description>&lt;P&gt;I attached a sample that is using a dockpane to show the selected [line] rows and the respective length.&amp;nbsp; Note that the length was computed using a area specific projection (in my case Hawaii), so you might want to change this to fit your needs.&amp;nbsp; When you click on a line in the grid the corresponding feature will flash on the map.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Wolf_0-1627321560965.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/19363i83748DD75AC59AA4/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Wolf_0-1627321560965.png" alt="Wolf_0-1627321560965.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 17:46:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1082757#M6939</guid>
      <dc:creator>Wolf</dc:creator>
      <dc:date>2021-07-26T17:46:19Z</dc:date>
    </item>
    <item>
      <title>Re: How do I measure the line length of several elements?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1082959#M6942</link>
      <description>&lt;P&gt;Thank you so much, if you had a problem I could still call?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Jul 2021 07:05:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1082959#M6942</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2021-07-27T07:05:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I measure the line length of several elements?</title>
      <link>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1083395#M6950</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I tried to transform the code into its own form, but I have a problem with lambda:&lt;/P&gt;&lt;P&gt;namespace ShowLineLength&lt;BR /&gt;{&lt;BR /&gt;internal class ShowSelectedLineLengths : Button&lt;BR /&gt;{&lt;BR /&gt;ProAppModule2.Form1 formular = new ProAppModule2.Form1();&lt;/P&gt;&lt;P&gt;protected override async void OnClick()&lt;BR /&gt;{&lt;BR /&gt;try&lt;BR /&gt;{&lt;BR /&gt;var result = await QueuedTask.Run&amp;lt;(ProAppModule2.Form1 formular ,double Total)&amp;gt;(() =&amp;gt;&lt;BR /&gt;{&lt;BR /&gt;double dTotalLen = 0.0;&lt;BR /&gt;// retrieve the currently selected features in the map view&lt;BR /&gt;var selectedFeatureSets = MapView.Active.Map.GetSelection();&lt;BR /&gt;var mapa = SpatialReferenceBuilder.CreateSpatialReference(3759);&lt;BR /&gt;// use this projection to get the most accurate length&lt;BR /&gt;if (MapView.Active != null)&lt;BR /&gt;{&lt;BR /&gt;// Get the active map view.&lt;BR /&gt;var mapView = MapView.Active;&lt;BR /&gt;// Get the list of selected layers.&lt;BR /&gt;IReadOnlyList&amp;lt;Layer&amp;gt; selectedLayerList = MapView.Active.GetSelectedLayers();&lt;BR /&gt;if (selectedLayerList.Count &amp;gt; 0)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;// for each of the map members that is a line feature we put a row&lt;BR /&gt;// into our dataTable&lt;BR /&gt;foreach (var selectedFeatureSet in selectedFeatureSets)&lt;BR /&gt;{&lt;BR /&gt;var featLayer = selectedFeatureSet.Key as BasicFeatureLayer;&lt;BR /&gt;if (featLayer == null) continue;&lt;BR /&gt;if (!(featLayer.ShapeType == esriGeometryType.esriGeometryPolyline)) continue;&lt;BR /&gt;// use the selection to get all records&lt;BR /&gt;using (var rowCursor = featLayer.Search(new QueryFilter() { ObjectIDs = selectedFeatureSet.Value }))&lt;BR /&gt;{&lt;BR /&gt;while (rowCursor.MoveNext())&lt;BR /&gt;{&lt;BR /&gt;using (var feature = rowCursor.Current as Feature)&lt;BR /&gt;{&lt;BR /&gt;var theLine = feature.GetShape();&lt;BR /&gt;if (theLine != null)&lt;BR /&gt;{&lt;BR /&gt;var projectedLine = GeometryEngine.Instance.Project(theLine, mapa) as Polyline;&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;formular.richTextBox1.Text = result.ToString();&lt;BR /&gt;formular.Show();&lt;/P&gt;&lt;P&gt;}&lt;BR /&gt;catch (Exception ex)&lt;BR /&gt;{&lt;BR /&gt;MessageBox.Show($@"Exception in ShowSelectedLineLengths: {ex}");&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;}&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Jul 2021 05:40:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-pro-sdk-questions/how-do-i-measure-the-line-length-of-several/m-p/1083395#M6950</guid>
      <dc:creator>DavidMrázek</dc:creator>
      <dc:date>2021-07-28T05:40:17Z</dc:date>
    </item>
  </channel>
</rss>

