functions to calculate area and extent