Refresh MapImageLayer JS API 4.5

2788
4
Jump to solution
11-01-2017 02:54 AM
RodrigoFelga
New Contributor III

I have a MapImageLayer with a point sublayer that I insert data outside the API, mt problem is that the newly inserted data is not refreshed until I move the map, how to refresh te MapImageLayer to reflect the changes made outside the API?

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Rodrigo,

  Since there is no such thing as view.reresh or layer refresh or any other method I can find to force a referesh you will have to use a workaround like view.goto. The best way to do this is to get the current view center and add 1 to the X or Y and use view goto with that new point coordinates. This will force a refresh and have minimal effect on the maps extent.

View solution in original post

4 Replies
RobertScheitlin__GISP
MVP Emeritus

Rodrigo,

  Since there is no such thing as view.reresh or layer refresh or any other method I can find to force a referesh you will have to use a workaround like view.goto. The best way to do this is to get the current view center and add 1 to the X or Y and use view goto with that new point coordinates. This will force a refresh and have minimal effect on the maps extent.

AndrewLindley
New Contributor III

I was having a similar problem and fixed it like this: 

view.extent = view.extent;

Robert's solution definitely works too, but just wanted to share this if anyone else is having this issue.

Cheers

AndrewLindley
New Contributor III

Just a quick update:

The above method of setting view.extent = view.extent has been unreliable for me, so I'm using Robert's suggested method now as well.

Cheers

KenBuja
MVP Esteemed Contributor

Most layers now can be refreshed in 2D MapViews by setting refreshInterval property or by calling refresh() method on it.

Release notes for 4.6 | ArcGIS API for JavaScript 4.6