<?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: Get shape_length for newly added lines in ArcGIS Enterprise Questions</title>
    <link>https://community.esri.com/t5/arcgis-enterprise-questions/get-shape-length-for-newly-added-lines/m-p/618116#M23760</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The feature layer edit-complete event returns a list of &lt;A href="https://developers.arcgis.com/javascript/jsapi/featureeditresult-amd.html"&gt;FeatureEditResults&lt;/A&gt;. This only has a limited number of properties to indicate if the operation was successful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To get the length of the new shape you would need to &lt;A href="https://developers.arcgis.com/javascript/jsapi/featurelayer-amd.html#queryfeatures"&gt;query the feature layer&lt;/A&gt; using the objectId property of the new line. You can define which fields to return in the query so you should be able to get the shape length.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 14 Feb 2015 23:48:31 GMT</pubDate>
    <dc:creator>OwenEarley</dc:creator>
    <dc:date>2015-02-14T23:48:31Z</dc:date>
    <item>
      <title>Get shape_length for newly added lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/get-shape-length-for-newly-added-lines/m-p/618115#M23759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm handling a linear feature layer's Edit-complete event and looking at the returned value for the newly created polyline feature.&amp;nbsp; It seems that in neither the attributes collection nor the geometry collection is the length of the polyline easily obtainable.&amp;nbsp; I guess I could apply a little Pythagorean theorem and solve it myself, but that seems just a bit crazy. Is there something I'm missing? And also, Is it &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;finally&lt;/STRONG&gt;&lt;/SPAN&gt; time to admit that Pythagoras was right and call his theorem a law??? I'm voting yes. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 13 Feb 2015 17:11:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/get-shape-length-for-newly-added-lines/m-p/618115#M23759</guid>
      <dc:creator>RiverTaig1</dc:creator>
      <dc:date>2015-02-13T17:11:22Z</dc:date>
    </item>
    <item>
      <title>Re: Get shape_length for newly added lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/get-shape-length-for-newly-added-lines/m-p/618116#M23760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The feature layer edit-complete event returns a list of &lt;A href="https://developers.arcgis.com/javascript/jsapi/featureeditresult-amd.html"&gt;FeatureEditResults&lt;/A&gt;. This only has a limited number of properties to indicate if the operation was successful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To get the length of the new shape you would need to &lt;A href="https://developers.arcgis.com/javascript/jsapi/featurelayer-amd.html#queryfeatures"&gt;query the feature layer&lt;/A&gt; using the objectId property of the new line. You can define which fields to return in the query so you should be able to get the shape length.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Feb 2015 23:48:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/get-shape-length-for-newly-added-lines/m-p/618116#M23760</guid>
      <dc:creator>OwenEarley</dc:creator>
      <dc:date>2015-02-14T23:48:31Z</dc:date>
    </item>
    <item>
      <title>Re: Get shape_length for newly added lines</title>
      <link>https://community.esri.com/t5/arcgis-enterprise-questions/get-shape-length-for-newly-added-lines/m-p/618117#M23761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you for the reply Owen; it's too bad that you have to query the feature layer (round-trip to server, right?) just to get the length of the polyline geometry which is obviously visible on the map. To get around this, I wrote the function below.&amp;nbsp; Thank you Mr. Pythagorus for suggesting this algorithm. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function GetShapeLengthFromPolylineGeometry(polylineGeometry){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Assumes that polylineGeometry has a single path&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var firstPath = polylineGeometry.paths[0]; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var totalLength = 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; for(var i = 0; i &amp;lt; firstPath.length - 1; i++){&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pointI = firstPath&lt;I&gt;;&lt;/I&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; pointIPlusOne = firstPath[i+1];&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sideA = pointI[0] - pointIPlusOne[0]; //delta X&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sideB = pointI[1] - pointIPlusOne[1]; //delta y&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; aSquared = sideA * sideA;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; bSquared = sideB * sideB;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c = Math.sqrt(aSquared + bSquared);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; totalLength +=&amp;nbsp; c;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //For me, I need the answer in feet, but the units are in meters&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var answer = totalLength * 3.28084;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return parseFloat(answer).toFixed(1);&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 18 Feb 2015 16:33:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-enterprise-questions/get-shape-length-for-newly-added-lines/m-p/618117#M23761</guid>
      <dc:creator>RiverTaig1</dc:creator>
      <dc:date>2015-02-18T16:33:11Z</dc:date>
    </item>
  </channel>
</rss>

