r.surf.contour(1)
π r.surf.contour π
okay bestie, so this is the r.surf.contour manual page from the GRASS GIS User's Manual, and it's literally about generating a surface raster map from rasterized contours. yes it's giving elevation-from-lines, and yes it ate. let's get into it π¦
β¨ NAME β¨
r.surf.contour β Generates surface raster map from rasterized contours. ποΈ
π KEYWORDS π
raster, surface, interpolation
π SYNOPSIS π
r.surf.contour
r.surf.contour --help
r.surf.contour input=name output=name [--overwrite] [--help]
[--verbose] [--quiet] [--ui]
πΈ Flags:
--overwriteβ Allow output files to overwrite existing files π (she's brave)--helpβ Print usage summary π«Ά--verboseβ Verbose module output (she talks a lot, relatable)--quietβ Quiet module output π€«--uiβ Force launching GUI dialog β¨
π Parameters:
input=name[required] β Name of input raster map containing contoursoutput=name[required] β Name for output raster map
π¦ DESCRIPTION π¦
So, r.surf.contour creates a raster elevation map from a rasterized contour map. Elevation values get determined using procedures similar to a manual methods. ngl, to determine the elevation of a point on a contour map, an individual might interpolate its value from those of the two nearest contour lines (uphill and downhill). iconic behavior tbh.
r.surf.contour works in a similar way. Initially, a vector map of the contour lines is made with the elevation of each line as an attribute. When the program v.to.rast is run on the vector map, continuous "lines" of rasters containing the contour line values will be the input for r.surf.contour. For each cell in the input map, either the cell is a contour line cell (which is given that value), or a flood fill is generated from that spot until the fill comes to two unique values. So the r.surf.contour algorithm linearly interpolates between contour lines. The flood fill is not allowed to cross over the rasterized contour lines, thus ensuring that an uphill and downhill contour value will be the two values chosen. r.surf.contour interpolates from the uphill and downhill values by the true distance. the way that it just... does the math π
π Parameters:
input=nameβ Name of an existing raster map that contains a set of initial category values (i.e., some cells contain known elevation values (denoting contours) while the rest contain NULL values).output=nameβ Name to be assigned to new output raster map that represents a smooth (e.g., elevation) surface generated from the known category values in the input raster map layer.
An existing MASK raster map is respected for both reading input and writing output. she respects boundaries, periodt π
β NOTES β
r.surf.contour works well under the following circumstances:
- the contour lines extend to the the edge of the current region,
- the program is run at the same resolution as that of the input map,
- there are no disjointed contour lines, and
- no spot elevation data BETWEEN contour lines exist.
Spot elevations at the tops of hills and the bottoms of depressions, on the other hand, improve the output greatly. π
Violating these constraints will cause non-intuitive anomalies to appear in the output map. π Runr.slope.aspectonr.surf.contourresults to locate potential anomalies.
The running of r.surf.contour is very sensitive to the resolution of rasterized vector map. If multiple contour lines go through the same raster, slight anomalies may occur. π The speed of r.surf.contour is dependent on how far "apart" the contour lines are from each other (as measured in raster cells). Since a flood fill algorithm is used, the program's running time will grow exponentially with the distance between contour lines. like she's fast until she's NOT bestie π’π₯
π EXAMPLE π
Example to create contour lines from elevation model, then recreating DEM from these contour lines along with differences analysis (North Carolina sample data set):
g.region raster=elevation -p
# get minimum elevation value
r.univar elevation
# generate vector contour lines
r.contour input=elevation output=contours_5m step=5 minlevel=50
# rasterize contour lines
v.info -c contours_5m
v.to.rast input=contours_5m output=contours_5m use=attr attribute_column=level
# generate DEM from rasterized contour lines
r.surf.contour input=contours_5m output=elevation_from_cont5m
# calculate difference map
r.mapcalc "diff = elevation - elevation_from_cont5m"
r.colors diff color=differences
# analyze differences statistically
r.univar diff
π SEE ALSO π
r.mapcalcr.slope.aspectr.surf.idwwxGUI vector digitizerv.surf.idwv.surf.rstv.to.rast
Overview: Interpolation and Resampling in GRASS GIS πΈ
π«Ά AUTHOR π«Ά
Chuck Ehlschlaeger, U.S. Army Construction Engineering Research Laboratory
π SOURCE CODE π
Available at: r.surf.contour source code (history)
Accessed: Saturday Jan 17 05:41:01 2026
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
okay that's the whole page bestie, no cap, every last crumb of it π and a lil sign-off for you: this was the GRASS GIS 8.4.2 Reference Manual, Β© 2003-2025 GRASS Development Team, and we read it at GRASS 8.4.2 / r.surf.contour(1) energy. slay, go interpolate something π
β¨
π¦ where this page comes from
- fedora 44: grass 8.4.2-4.fc44 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms