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?
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.
Most layers now can be refreshed in 2D MapViews by setting refreshInterval property or by calling refresh() method on it.
refreshInterval
refresh()
Release notes for 4.6 | ArcGIS API for JavaScript 4.6
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
I was having a similar problem and fixed it like this:
view<SPAN class="punctuation token">.</SPAN>extent <SPAN class="operator token">=</SPAN> view<SPAN class="punctuation token">.</SPAN>extent<SPAN class="punctuation token">;</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN></SPAN>
Robert's solution definitely works too, but just wanted to share this if anyone else is having this issue.
Přihlášení členové mohou přispívat, sledovat aktualizace a další. Jste tu noví? Zaregistrujte si bezplatný účet.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.