Calculate the area for each contour created by the rasterToContour

Hi community,
I am trying to calculate the area for each contour obtained from the rasterToContour function.

Any of you have faced this before.

I appreciate any suggestions.

The contour is an approximation of the raster. Wouldn't it be easier to calculate the areas directly by binning the raster data?

Anyway, according to the documentation for rasterToContour, the results is a SpatialLinesDataFrame (sp package). So you should be able to use functions from the sp package to calculate the areas. You might need to convert the spatial lines to polygons first, and then maybe intersect the polygons for the different contours.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.