AnsweredAssumed Answered

When is a feature layer ready for querying?

Question asked by kristofferjohansen on Jul 17, 2018
Latest reply on Jul 17, 2018 by Jefairfi

I want to draw markers on the map based on IDs from external source. I use the IDs to do queries to a feature layer and then use the resulting data to draw markers on the map but I not know when the feature layers are ready. I know this works when I do the queries after the map and feature layer is ready.

 

You can use mapView.when to know when the mapView is ready. But the feature layers are not necessarily ready at this point. So I cannot use the IDs I pass to the map to do queries against the feature layers (because they are not ready).

mapView.when( () => {
   console.log('MapView is ready, but not the featurelayers!')
})

 

Is there a way to know not only when the map is ready, but also when the feature layers are loaded and ready for querying?

 

I am using ArcGIS JS 4.7 API and my apps and maps are hosted using ArcGIS Portal. My feature layers are connected to the maps in the portal

Outcomes