Highest and lowest point of a map?

Is it possible to find it via code?