AnsweredAssumed Answered

Create Polyline From Variable, result adds quotes?

Question asked by Vepraskas on Aug 21, 2014
Latest reply on Aug 21, 2014 by rscheitlin

I am trying to create a polyline from points collected via GPS... The last remaining piece is that when I try and post the points to polyline the code adds quotes around the coordinates and is causing the post to fail.

 

            lineARRAY = lineARRAY.substring(0, lineARRAY.length - 1);
            var linejs = "[[" + lineARRAY + "]]";        
            
            var singlePathPolyline = new esri.geometry.Polyline({"paths":linejs,"spatialReference":{"wkid":32054}});
            var newAttributesG = dojo.mixin({}, GPSlayerLine.attributes);
            var newGraphicL = new esri.Graphic(singlePathPolyline, null, newAttributesG);
            GPSlayerLine.applyEdits([newGraphicL], null, null);  

 

The resulting post is:

 

[{"geometry":{"paths":[["[2498591.1952441176,335712.1545436013],[2498591.1952441176,335712.1545436013],[2498591.1952441176,335712.1545436013],[2498591.1952441176,335712.1545436013],[2498591.1952441176,335712.1545436013],[2498591.1952441176,335712.1545436013],"]],"spatialReference":{"wkid":32054}},"attributes":{}}]

As you can see it adds a double quote after paths (ex. "paths":[["[ ) Offending quotes in red?

 

Any idea on how to alter the attached code so I can eliminate the addition of those quotes?

 

Thanks

Outcomes