Select to view content in your preferred language

Selecting features within a SceneLayerView by graphic in an experience builder custom widget

559
0
01-25-2024 04:06 AM
Labels (2)
IsobelMcLees
Emerging Contributor

I am trying to create a widget where a user can select one or multiple features in a scene layer using a graphic that thay have draw, so either a point or a polygon. These selected features will also be highlighted once selected. 

I have largely been following the sample code in this link SceneLayerView - query statistics by geometry

The error I am getting, is that when I am creating the view of the scene layer, the sceneLayerView seems to be null/ is not initializing properly and hence is not being queried. Any help would be appreciated!

 

const graphicsLayer = new GraphicsLayer()
jmv.view.map.add(graphicsLayer)
console.log("debug message B")

let sceneLayer = null;
let sceneLayerView = null;

//Assign scenelayer once scene layer is loaded
const map = jmv.view.map;
console.log("debug message D")

sceneLayer = map.layers.find((layer) => {
    return layer.title === "1612_GF_PGM"
});

console.log(sceneLayer.type)

sceneLayer.outfields = ["label", "elevation"]

console.log("initalialising sceneLayerView")
console.log(sceneLayer.title)

jmv.whenJimuLayerViewLoaded(sceneLayer).then((layerView) => {
    sceneLayerView = layerView
    console.log(sceneLayerView)
});
           

 

 

 

0 Kudos
0 Replies