arcgis javascript imagery layer refresh method

1047
1
01-27-2018 02:15 PM
DavidPuckett
Occasional Contributor

As of version 4.6, the arcgis javascript API does not support a refresh method on a layer in a 3D scene view (only supported in 2D map view). See 'Known Limitations' here

ImageryLayer | API Reference | ArcGIS API for JavaScript 4.6 

So I thought I'd share what I've found as a workaround. You simply set the layer visibility to false then set a zero length timer to set it back to true (it does not work to set it back to true without the timeout, for whatever reason).

A sample:

activeImageryLayer.visible = false;

window.setTimeout(function() { activeImageryLayer.visible = true; }, 0);

The downside here is that it does visibly 'flicker' the layer when it is turned off. This is acceptable for my project but is still a little janky.

I'd be interested to hear what others have implemented as a workaround for this glaring omission from the API.

0 Kudos
1 Reply
JohnGrayson
Esri Regular Contributor

I can't recall the exact details, but I think I've used this in the past:

view.extent = view.extent;
0 Kudos