1

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";
 }
PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jan 27, 2023 at 12:50

1 Answer 1

4

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
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.