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
Solved! Go to Solution.
Paul,
Your issue is that lineArray is actually a string (thus the double qoutes) and not an actual array. You need to build and array not a string.
Paul,
Your issue is that lineArray is actually a string (thus the double qoutes) and not an actual array. You need to build and array not a string.