Detect loaded maps in MapView

Jump to solution
02-11-2021 01:01 PM
Occasional Contributor

I am loading two maps in a view. One map is the basemap "streets", and the other is from a 3rd party provider that is infrequently unavailable. How can I know if the "streets" basemap is the only map loaded in the view?


const map = new Map({
   basemap: "streets"

const anothermap = new GroupLayer({
   title: "Aerials",
   visible: true,
   visibilityMode: "exclusive",
   layers: tileServers

I only want to know if "anothermap" did not get loaded.
 I found this post by Robert S. but baseLayerViews is always 0.

var view = new MapView({
map: map,

view.when(function () {

//  this is always 0 and it blows up
//  view.basemapView.baseLayerViews.getItemAt(0)

    watchUtils.whenFalse(view.basemapView.baseLayerViews.getItemAt(0), 'updating', (updating) => {
        console.log('Done Updating');
      } else {
        watchUtils.whenTrueOnce(view, "stationary", (still) => {
          console.log('Done Updating');




Tags (1)
0 Kudos
1 Solution

Accepted Solutions
3 Replies
MVP Honored Contributor

This blog post shows how you can tell when a layer is loaded and ready:

0 Kudos
Occasional Contributor

I want to know if the basemap is the only map in the view when the entire view is done. 

- basemap--------Loaded
- anothermap----Not loaded
-- layers

0 Kudos