How to determine the height based from the terrain

Hello!

I’m trying to dynamically adjust the height of setView based from the Rectangle