0

I have a function that allows move a point by angle and distance enter image description here

The problem is that after move the point, this doesn't show in map: enter image description here

Sometimes the line also disappears

This is a summary of the code to update the coordinates of the point:

loFL = goMap.getLayer("points_layer");
//take the first graphic (The point) and update            
loFL.graphics[0].geometry.x = newX;
loFL.graphics[0].geometry.y = newY;                   
loFL.redraw();

PD: 'loFL' it's a FeatureLayer created with a FeatureCollection

  • Is points_layer a FeatureLayer or GraphicsLayer? If FeatureLayer are you creating it by sending a service URL? – GavinR Mar 1 '18 at 17:20
  • it's a FeatureLayer, created with a FeatureCollection. – Pilgrim Mar 1 '18 at 21:17
  • Which version of the JavaScript API are you using? – GavinR Mar 2 '18 at 2:46
  • it's the version 3 – Pilgrim Mar 2 '18 at 12:53
2

It looks like your code:

loFL = goMap.getLayer("points_layer");
//take the first graphic (The point) and update            
loFL.graphics[0].geometry.x = newX;
loFL.graphics[0].geometry.y = newY;                   
loFL.redraw();

Should indeed work fine for Feature Layers created with a FeatureCollection. Code example here.

  • Yes, the layer was created with a FeatureCollection – Pilgrim Mar 12 '18 at 15:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.