Arcade/ArcGIS Pro 2.9:
I have an array of polyline vertices:
[[[670634.3148,4862051.3579,null],[670719.3321,4862051.0072,null],[670721.44381227,4862055.2956567,null],
[670724.26721751,4862059.1529319,null],[670727.71675869,4862062.4621395,null],[670731.6879051,4862065.1230012,null],
[670736.06031997,4862067.0548856,null],[670740.70150695,4862068.1992512,null],[670745.47082515,4862068.5214206,null],
[670750.22375097,4862068.011631,null],[670754.81625751,4862066.6853305,null],[670759.10917905,4862064.5827098,null],
[670762.97242811,4862061.7674841,null],[670766.2889375,4862058.3249626,null],[670768.95820776,4862054.3594632,null],
[670770.89935255,4862049.9911516,null],[670772.0535498,4862045.3523998,null],[670772.38582412,4862040.583775,null],
[670771.88610666,4862035.8297796,null],[670770.56954026,4862031.2344731,null],[670768.47602054,4862026.9371059,null],
[670765.66898698,4862023.0679004,null],[670762.2335005,4862019.7441041,null],[670758.27366592,4862017.0664373,null],
[670753.90947724,4862015.1160409,null],[670749.27318152,4862013.9520171,null],[670744.50527143,4862013.6096393,null],
[670739.75022791,4862014.0992824,null],[670735.15214202,4862015.4061089,null],[670730.85034857,4862017.4905182,null],
[670726.97520385,4862020.289347,null],[670723.64413555,4862023.717783,null],[670720.95808431,4862027.6719349,null],
[670718.99844495,4862032.0319811,null],[670717.8246,4862036.6658,null]]]
I want to convert the array to a polyline so that I can use Arcade geometry functions on it.
I've searched the docs, but I can't seem to find an Arcade function that converts an array to a polyline. I see there is a FromJSON()
function, but I don't think my array is JSON. And I don't see a FromArray()
function in the docs.
How can I convert the array to a polyline using Arcade?
paths
property of thePolyline
object is giving you is the same paths that is set in JSON to pass to the Polyline constructor. Take what you have and embed it into JSON structure and add a"spatialReference"
property, and then pass it to Polyline constructor.