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?
Example
const map = new Map({ basemap: "streets"});const anothermap = new GroupLayer({ title: "Aerials", visible: true, visibilityMode: "exclusive", layers: tileServers});map.add(anothermap);
const map = new Map({ basemap: "streets"});
const anothermap = new GroupLayer({ title: "Aerials", visible: true, visibilityMode: "exclusive", layers: tileServers});map.add(anothermap);
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) => { if(view.stationary){ console.log('Done Updating'); } else { watchUtils.whenTrueOnce(view, "stationary", (still) => { console.log('Done Updating'); }); } }); [...]
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) => { if(view.stationary){ console.log('Done Updating'); } else { watchUtils.whenTrueOnce(view, "stationary", (still) => { console.log('Done Updating'); }); } });
[...]
Solved! Go to Solution.
Thank you, Rene!
https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-TileLayer.html#loadError
View solution in original post
This blog post shows how you can tell when a layer is loaded and ready: https://odoe.net/blog/when-are-layers-done
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