This function queries the elevation data for a shape within a DEM raster. If the latitude and longitude are not provided, the function will use the centroid of the shape. If the elevation data is not found for the first point, the function will try other points on the shape.