AnsweredAssumed Answered

i cant add graphic from json

Question asked by babycrash on Oct 15, 2020
Latest reply on Oct 16, 2020 by ubatsukh-esristaff

hi i am trying to add graphic to graphicslayer. here is the problem.

i get json result from sketchviewmodel create function which is graphic.

i store this in to new jsonobject. then i try to add this graphic into graphicslayer manually. but its giving error.

here is the json

{ "geometry":{     "spatialReference":{      "latestWkid":3857,      "wkid":102100   },   "x":243208.09643883476,   "y":2940285.766420703,   "z":351.9580905416081 }, "symbol":{   "type":"point-3d",   "symbolLayers":[      {         "type":"Icon",         "material":{                     },         "resource":{            "primitive":"kite"         },         "size":15,         "outline":{            "color":[               0,               0,               0            ],            "size":2.25         }      }   ] },   "attributes":{      },    "popupTemplate":null }

this code gives error

const [Graphic] = await loadModules(["esri/Graphic"]); let g =  new Graphic(data); // data which is json i gave.

any adivce ? Thank you.