AnsweredAssumed Answered

Automatically populate latitude longitude values with graphic move

Question asked by schlot on Jan 27, 2016
Latest reply on Jan 27, 2016 by kenbuja

I'm confused about how to use applyEdits to update my latitude and longitude columns once my graphic has been moved. It seems like I need to have a complete Graphic element created to use as input for applyEdits.


This isn't giving my any errors, but when I tried this, it doesn't change my attributes.


        app.myEditor.editToolbar.on('graphic-move-stop', function(evt){
          var currentGraphic = evt.graphic;
        var latLongCoord = webMercatorUtils.xyToLngLat(evt.graphic.geometry.x, evt.graphic.geometry.y);
     //     console.log("Latitude:  " + latLongCoord[1] + ", Longitude:  " + latLongCoord[0]); 
          var latCoor = latLongCoord[1].toFixed(6);
          var longCoor = latLongCoord[0].toFixed(6);
        var att = {
          "Name": currentGraphic.attributes.Name,
          "Address": currentGraphic.attributes.Address,
          "City": currentGraphic.attributes.City,
          "State": currentGraphic.attributes.State,
          "ZIP": currentGraphic.attributes.ZIP,
          "Phone": currentGraphic.attributes.Phone,
          "Cell": currentGraphic.attributes.Cell,
          "Latitude": latCoor,
        var updateGraphic = new Graphic(currentGraphic,mySymbols.redPinSymbol_edit(),att);
        app.eusLayer.applyEdits(null,[updateGraphic], null );