I tried to connect my query code to the button. I want to show my 3D building features on a map related to their height values. When I click or slide my button, I want to see or highlight buildings that are called related to height. How can I connect them?
I tried like this :
let a = document.getElementById("slider-1").value;
if(a <= 10){
extrudedBuildings.definitionExpression = "height < 10";
} else if (a < 20) {
extrudedBuildings.definitionExpression = "height < 20";
}
asked Jan 27, 2023 at 12:50
1 Answer 1
You have to add a listener that will respond when the slider is moved
document.getElementById("slider-1").oninput = function() {
if(this.value <= 10)
{
extrudedBuildings.definitionExpression = "height < 10";
} else if (this.value < 20)
{
extrudedBuildings.definitionExpression = "height < 20";
}
//or just use the value directly
//extrudedBuildings.definitionExpression = "height < " + this.value;
}
answered Jan 27, 2023 at 15:10
lang-js