AnsweredAssumed Answered

Total Length of Polyline

Question asked by kawish on Nov 11, 2019
Latest reply on Nov 11, 2019 by NSager-esristaff

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.

 

let geometryService = new GeometryService({
                    url:url
                })
                geometryService.simplify([line]).then(function (line) {
                    var areasAndLengthParams = new LengthsParameters({
                        lengthUnit: "kilometers",
                        polylines: line
                    });
                    console.log(areasAndLengthParams)
                   /*  geometryService.Length(areasAndLengthParams).then(function (results) {
                        console.log("area: ", results.areas[0]);
                        console.log("length: ", results.lengths[0]);
                    }); */

                });

Outcomes