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";
    }

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;
} 
0

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.