AnsweredAssumed Answered

geometryService.lengths() is not working on the 4.8

Question asked by Rn2018 on Sep 20, 2018
Latest reply on Sep 21, 2018 by Rn2018

Hello,

 

I've take the code from here :

ArcGIS API for JavaScript Sandbox 

 

And i've added this code

 

var lengthParamsCliped = new LengthsParameters();
lengthParamsCliped.calculationType = 'geodesic';
lengthParamsCliped.geodesic = true;
lengthParamsCliped.lengthUnit = 'METER';
lengthParamsCliped.polylines = [polyline];

geometryService.lengths(lengthParamsCliped).then(calculatedClippedLength);

function calculatedClippedLength(res)
{
console.info(res);
}

 

The code stop with the message "a.toJSON is not a function"

Where a is the polyline who looks like that:

 

  1. a: Object
    1. pathsArray(3)
      1. 0Array(2)
        1. 0-111.3
        2. 152.68
        3. length2
        4. __proto__Array(0)
      2. 1Array(2)
        1. 0-98
        2. 149.5
        3. length2
        4. __proto__Array(0)
      3. 2Array(2)
        1. 0-93.94
        2. 129.89
        3. length2
        4. __proto__Array(0)
      4. length3
      5. __proto__Array(0)
    2. spatialReference:
      1. wkid4326
      2. __proto__Object
    3. type"polyline"
    4. __proto__Object

 

I will be grateful if someone could help me to find a solution.

 

Thanks in advance

 

Best regards

RN

 

#geometryService

#lengths()

#4.8

#4.x

#a.toJSON

Outcomes