compute terrain map array