<?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: geodesicLengths returns NaN in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geodesiclengths-returns-nan/m-p/88429#M8016</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well i am getting a similar error that Length is returning NaN.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The vertices of the line features are not duplicate but still the problem is arising.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1278799.757 2755664.841&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1278726.952 2755624.480&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1278643.215 2755578.058&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1278639.237 2755578.200&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1278638.736 2755578.218&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the difference is only in the decimal places but they are different.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you tell me how to resolve this problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thank you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 24 Jan 2013 12:14:23 GMT</pubDate>
    <dc:creator>shreyesshiv</dc:creator>
    <dc:date>2013-01-24T12:14:23Z</dc:date>
    <item>
      <title>geodesicLengths returns NaN</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geodesiclengths-returns-nan/m-p/88426#M8013</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I'm getting an invalid value (NaN) back from the esri.geometry.geodesicLengths function for certain lines. This only happens occasionally, and I haven't detected a pattern as to what about the path is triggering the error. Here's an example that displays the problem. I tried this with the 3.1 API.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;function init() {
&amp;nbsp; var line = new esri.geometry.Polyline({"paths":[[[-113.3388907526918,53.6252478988518],[-113.27571936597303,53.57961406863708],[-113.27571936597303,53.57961406863708],[-113.27571936597303,53.566566774741844],[-113.28121253003553,53.53964401478653],[-113.30318518628555,53.519236579065456],[-113.32241126050428,53.50943751677841],[-113.34438391675431,53.50943751677841],[-113.36772986401994,53.51025419185318],[-113.3869559382387,53.51678702593175],[-113.41167517651995,53.53882790615631],[-113.41030188550432,53.560041617991864],[-113.40068884839496,53.58613620592375],[-113.35262366284805,53.62036091795674],[-113.3388907526918,53.6252478988518]]],"spatialReference":{"wkid":4326}});
 
&amp;nbsp; var lengths = esri.geometry.geodesicLengths([line], esri.Units.METERS);
&amp;nbsp; document.write("Measured length is: " + lengths[0]);
 }
 
 dojo.addOnLoad(init);&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The above line is derived from a polygon so closes on itself, but other I've had this with other polylines that do not close on themselves.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 06 Sep 2012 23:45:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geodesiclengths-returns-nan/m-p/88426#M8013</guid>
      <dc:creator>BryanBaker</dc:creator>
      <dc:date>2012-09-06T23:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: geodesicLengths returns NaN</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geodesiclengths-returns-nan/m-p/88427#M8014</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;There's a duplicated vertex in your line which is causing the calculation to fail. Try this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
var line = new esri.geometry.polyline({
&amp;nbsp; "paths": [
&amp;nbsp;&amp;nbsp;&amp;nbsp; [
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [-113.3388907526918, 53.6252478988518],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [-113.27571936597303, 53.57961406863708],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // [-113.27571936597303, 53.57961406863708], // &lt;SPAN style="color:&amp;quot;#FF0000&amp;quot;;"&gt;duplicate&lt;/SPAN&gt; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [-113.27571936597303, 53.566566774741844],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [-113.28121253003553, 53.53964401478653],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [-113.30318518628555, 53.519236579065456],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [-113.32241126050428, 53.50943751677841],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [-113.34438391675431, 53.50943751677841],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [-113.36772986401994, 53.51025419185318],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [-113.3869559382387, 53.51678702593175],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [-113.41167517651995, 53.53882790615631],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [-113.41030188550432, 53.560041617991864],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [-113.40068884839496, 53.58613620592375],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [-113.35262366284805, 53.62036091795674],
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [-113.3388907526918, 53.6252478988518]
&amp;nbsp;&amp;nbsp;&amp;nbsp; ]
&amp;nbsp; ],
&amp;nbsp; "spatialreference": {
&amp;nbsp;&amp;nbsp;&amp;nbsp; "wkid": 4326
&amp;nbsp; }
});
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;On jsfiddle (length printed to the console): &lt;/SPAN&gt;&lt;A href="http://jsfiddle.net/nLpax/" rel="nofollow noopener noreferrer" target="_blank"&gt;http://jsfiddle.net/nLpax/&lt;/A&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 23:23:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geodesiclengths-returns-nan/m-p/88427#M8014</guid>
      <dc:creator>derekswingley1</dc:creator>
      <dc:date>2021-12-10T23:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: geodesicLengths returns NaN</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geodesiclengths-returns-nan/m-p/88428#M8015</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks - that's odd about the duplicate vertex. That line was derived directly from the freehand polygon/polyline draw toolbars. So apparently those tools are occasionally producing duplicate points. I'll have to weed those out in code I suppose.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 07 Sep 2012 16:30:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geodesiclengths-returns-nan/m-p/88428#M8015</guid>
      <dc:creator>BryanBaker</dc:creator>
      <dc:date>2012-09-07T16:30:23Z</dc:date>
    </item>
    <item>
      <title>Re: geodesicLengths returns NaN</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geodesiclengths-returns-nan/m-p/88429#M8016</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Well i am getting a similar error that Length is returning NaN.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The vertices of the line features are not duplicate but still the problem is arising.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1278799.757 2755664.841&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1278726.952 2755624.480&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1278643.215 2755578.058&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1278639.237 2755578.200&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;1278638.736 2755578.218&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;the difference is only in the decimal places but they are different.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Can you tell me how to resolve this problem.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;thank you&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 12:14:23 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geodesiclengths-returns-nan/m-p/88429#M8016</guid>
      <dc:creator>shreyesshiv</dc:creator>
      <dc:date>2013-01-24T12:14:23Z</dc:date>
    </item>
    <item>
      <title>Re: geodesicLengths returns NaN</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geodesiclengths-returns-nan/m-p/88430#M8017</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;The input has to be in GCS.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;Well i am getting a similar error that Length is returning NaN.&lt;BR /&gt;The vertices of the line features are not duplicate but still the problem is arising.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;1278799.757 2755664.841&lt;BR /&gt;1278726.952 2755624.480&lt;BR /&gt;1278643.215 2755578.058&lt;BR /&gt;1278639.237 2755578.200&lt;BR /&gt;1278638.736 2755578.218&lt;BR /&gt;&lt;BR /&gt;the difference is only in the decimal places but they are different.&lt;BR /&gt;&lt;BR /&gt;Can you tell me how to resolve this problem.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;thank you&lt;/BLOCKQUOTE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 24 Jan 2013 18:16:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/geodesiclengths-returns-nan/m-p/88430#M8017</guid>
      <dc:creator>JianHuang</dc:creator>
      <dc:date>2013-01-24T18:16:46Z</dc:date>
    </item>
  </channel>
</rss>

