Hi,
I'm getting the error:
message: "No layerview has been found for the layer"
name: "view:no-layerview-for-layer"
for the FeatureLayer that's been created from the graphics using the source property. Despite it, the symbols and labels draw just fine, but I need a view to watch some properties of the view !
I'd like to know why there is no view for such layers. If you think / know that each FeatureLayer should have the view and this is a bug and require more code, please let me know, but it's a standard FeatureLayer from graphics and then on SceneView.whenLayerView is just throwing the error in the err-callback.
Codepen (follow the sample instructions -> download shapefile -> upload shapefile and watch the layerview fail in console):
https://codepen.io/anon/pen/mYGwzK?editors=1001#anon-login
Thanks!
Solved! Go to Solution.
Hi there,
Your code for `view.whenLayerView` logic is running before you add the layer to the map. LayerView for the layer will be created when the layer is loaded to the view.
So either move your code out of the current function and place after you add the layer to the map or do something like the following then you will get the layerView back:
map.add(featureLayer);
view.goTo(graphics);
view.whenLayerView(featureLayer).then(layerView => {
console.log('we have the layer view.')
}, (error) => {
console.log('we dont have the layer view: ', error)
});
Hi there,
Your code for `view.whenLayerView` logic is running before you add the layer to the map. LayerView for the layer will be created when the layer is loaded to the view.
So either move your code out of the current function and place after you add the layer to the map or do something like the following then you will get the layerView back:
map.add(featureLayer);
view.goTo(graphics);
view.whenLayerView(featureLayer).then(layerView => {
console.log('we have the layer view.')
}, (error) => {
console.log('we dont have the layer view: ', error)
});