Description
This tool creates contours (lines) based on a raster dataset representing continuous data (e.g. a digital elevation model), and a set of user-defined levels representing the z-values at which to generate the contours. The output is a line (polyline) dataset, with the z-values for each contour line recorded in the attribute table.
This algorithm produces high-quality contour lines at the expense of processing time. It interprets the raster as a triangular regular network and performs a plane intersection to determine the paths of the contour lines. It does not perform any sort of smoothing on the line, which I have reservations about. I have not been able to test this algorithm widely, so if you are able to find degenerate examples where the algorithm performs poorly, I would be grateful to hear about them so that the algorithm can be improved.
Although a 'band' option is included so that users can identify which band to process in the case of multiband images, it is likely that this tool will most often be run with continuous, single-band raster data (like DEM's).
Syntax
contour(in, out, levels, [band]);
| in | the input integer raster data source | |
| out | the output line data source | |
| levels | the z-values at which to generate contours. e.g. 100 or c(10,20,30) | |
| [band] | the input band (default=1) |
Example
contour(in="C:\data\dem", out="C:\data\contours.shp", levels=c(1000,2000,3000,4000,5000));
contour(in="C:\data\dem", out="C:\data\contours.shp", levels=0.05);
contour(in="C:\data\dem", out="C:\data\contours.shp", levels=r.eval(seq(100,10000,100)));