Editing an existing geometry using SKETCH

140
0
11-28-2022 11:01 PM
DivyaArora
New Contributor III

Using Sketch widget I am able to draw new polygons but if i add an existing geometry to the sketch layer and try to perform edit operations on that geometry it does not work. Below is the code that I have used to add a test geometry on the existing layer

    const addTestGeometry = (sketchViewLayer: GraphicsLayer, addSketch?: boolean) => {
        const testPolygon = {
                        type: "polygon",
                        rings: [[[-94.0160088356458,41.7427117569153],[-94.01606426169883,41.743337920868925],[-94.01622937204804,41.743948662786124],[-94.01649994461162,41.74452890244177],[-94.01686942168799,41.74506443144324],[-94.01732864046123,41.74554198013328],[-94.01786628215878,41.7459498876822],
                        [-94.01846923137747,41.74627803489088],[-94.01912248625209,41.74651838020961],
                        [-94.01980996693902,41.74666502660463],[-94.020514964774,41.74671428845829],
                        [-94.02121987277745,41.74666502660463],[-94.02190735346439,41.74651838020961],
                        [-94.022560608339,41.74627803489088],[-94.0231635575577,41.7459498876822],
                        [-94.02370119925523,41.74554198013328],[-94.02416041802849,41.74506443144324],
                        [-94.02452989510483,41.74452890244177],[-94.02480046766841,41.743948662786124],
                        [-94.02496557801763,41.743337920868925],[-94.02502100407068,41.7427117569153],
                        [-94.02496557801763,41.74208565388321],[-94.02480046766841,41.74147489424567],
                        [-94.02452989510483,41.74089462699183],[-94.02416041802849,41.74035906321225],
                        [-94.02370119925523,41.73988140894423],[-94.0231635575577,41.73947352987304],[-94.022560608339,41.739145347888325],[-94.02190735346439,41.73890497497027],[-94.02121987277745,41.73875831085158],[-94.020514964774,41.73870904289379],[-94.01980996693902,41.73875831085158],[-94.01912248625209,41.73890497497027],[-94.01846923137747,41.739145347888325],[-94.01786628215878,41.73947352987304],[-94.01732864046123,41.73988140894423],[-94.01686942168799,41.74035906321225],[-94.01649994461162,41.74089462699183],[-94.01622937204804,41.74147489424567],[-94.01606426169883,41.74208565388321],[-94.0160088356458,41.7427117569153]]],
                        // hasZ: false,
                        // hasM: false,
                        spatialReference: SpatialReference.WGS84
                        // spatialReference: {
                        //     wkid: 102100,
                        //     latestWkid: 3857 },
         };
         const simpleFillSymbol = {
            type: "simple-fill",
            color: [227, 139, 79, 0.8],  // Orange, opacity 80%
            outline: {
                color: [255, 255, 255],
                width: 1
            }
         };
         const polygonGraphic = new Graphic({
            geometry: testPolygon,
            symbol: simpleFillSymbol,
       
         });
         sketchViewLayer.add(polygonGraphic);
  
    }
0 Kudos
0 Replies