Changing Graphic Geometry (Moving Graphic) 4.x

2683
2
Jump to solution
01-23-2017 06:47 PM
GabrielLittman
New Contributor

Hi All,

I'm am trying to create a FeatureLayer that updates in real time in the ArcGIS API for JavaScript in 4.x.  I seem to be able to update my graphic object (change the geometry) and it looks right when I print it out the console.  But the graphic doesn't seem to move on the map.  The only way I seem to be able to get it to move is to remove it from the layer and add a new graphic.  Am I missing something?  Is what I'm trying to do possible?

Gabe

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Gabriel,

  According to the 4.x functionality matrix:

Functionality matrix | ArcGIS API for JavaScript 4.2 

Modify graphicsComing soonTo modify a graphic that is already added to the layer: you need to clone it, make modifications, add it to the layer and remove the original graphic. In-place modification of graphic objects will not trigger display refresh.

View solution in original post

2 Replies
RobertScheitlin__GISP
MVP Emeritus

Gabriel,

  According to the 4.x functionality matrix:

Functionality matrix | ArcGIS API for JavaScript 4.2 

Modify graphicsComing soonTo modify a graphic that is already added to the layer: you need to clone it, make modifications, add it to the layer and remove the original graphic. In-place modification of graphic objects will not trigger display refresh.
ReneRubalcava
Frequent Contributor

I just wrote about this.

Quick Tip - Clone in ArcGIS JSAPI - odoenet 

Here is a demo app

JS Bin - Collaborative JavaScript Debugging 

It's not real editing, but can be useful.