Hi
I am confused to calculate total length of line feature with arcgis API for java script.
any one can help me...???
I found following code but it's not working.
<SPAN class="keyword token">let</SPAN> geometryService <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">GeometryService</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN>
url<SPAN class="punctuation token">:</SPAN>url
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN>
geometryService<SPAN class="punctuation token">.</SPAN><SPAN class="token function">simplify</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">[</SPAN>line<SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">.</SPAN><SPAN class="token function">then</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="keyword token">function</SPAN> <SPAN class="punctuation token">(</SPAN>line<SPAN class="punctuation token">)</SPAN> <SPAN class="punctuation token">{</SPAN>
<SPAN class="keyword token">var</SPAN> areasAndLengthParams <SPAN class="operator token">=</SPAN> <SPAN class="keyword token">new</SPAN> <SPAN class="token class-name">LengthsParameters</SPAN><SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">{</SPAN>
lengthUnit<SPAN class="punctuation token">:</SPAN> <SPAN class="string token">"kilometers"</SPAN><SPAN class="punctuation token">,</SPAN>
polylines<SPAN class="punctuation token">:</SPAN> line
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN>
console<SPAN class="punctuation token">.</SPAN><SPAN class="token function">log</SPAN><SPAN class="punctuation token">(</SPAN>areasAndLengthParams<SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">/* geometryService.Length(areasAndLengthParams).then(function (results) {
console.log("area: ", results.areas[0]);
console.log("length: ", results.lengths[0]);
}); */</SPAN>
<SPAN class="punctuation token">}</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>