You need to collect all the coordinates present inside the polygon and get the min max height. Check this post about it.