Select to view content in your preferred language

How to tell if an Imagery Layer is drawn in the view in 4.5?

627
1
Jump to solution
11-09-2017 03:17 PM
AndrewLindley
New Contributor III

I am having trouble finding an event to watch for to tell if an imagery layer is drawn/rendered in the view.

I am programmatically updating the definition expression/mosaic rule where clause of an imagery layer to allow the user to toggle individual rasters on/off within an image service that includes 100+ rasters. The toggle works alright, but the toggle on from an off state takes 10+ seconds sometimes, so I want to add a spinner to let the user know the raster is drawing. 

My problem is that I can't figure out what to hook up the 'hide-spinner' event to. I have tried watching the imageryLayer.loaded property, but this becomes true immediately after the toggle is clicked but before the imagery layer actually becomes visible in the view. Similarly, all of the imageryLayer's properties related to its loading (loaded, loadStatus, etc.) fire in the same way. 

I have tried watching the view and layerview's 'updating' property as well, but to no avail.

Any ideas?

Thanks

0 Kudos
1 Solution

Accepted Solutions
AndrewLindley
New Contributor III

Update: solved! (right after i post about it of course)

This works:

view.whenLayerView(imageryLayer).then(function(layerView) {
   watchUtils.watch(layerView, "updating", function(newVal) {
      // code to fire
   });
});‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

View solution in original post

0 Kudos
1 Reply
AndrewLindley
New Contributor III

Update: solved! (right after i post about it of course)

This works:

view.whenLayerView(imageryLayer).then(function(layerView) {
   watchUtils.watch(layerView, "updating", function(newVal) {
      // code to fire
   });
});‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
0 Kudos