r.surf.contour(1grass)
β¨ NAME β¨
okay bestie, gather round π this is r.surf.contour β the GRASS module that generates surface raster map from rasterized contours. like, it takes your lil contour lines and builds a whole elevation surface out of them. no cap.
π·οΈ KEYWORDS π·οΈ
raster, surface, interpolation β that's the vibe β¨
π SYNOPSIS π
r.surf.contour
r.surf.contour --help
r.surf.contour input=name output=name [--overwrite] [--help]
[--verbose] [--quiet] [--ui]
π© Flags π©
--overwriteβ bestie this lets your output files overwrite existing files. use with intention ok π--helpβ prints the usage summary. your lil cheat sheet π--verboseβ verbose module output, so it tells you everything it's doing π£οΈ--quietβ quiet module output, for when you want peace and quiet β¨--uiβ forces the GUI dialog to launch. main character GUI energy π
ποΈ Parameters ποΈ
input=name[required] β Name of input raster map containing contoursoutput=name[required] β Name for output raster map
π DESCRIPTION π
so like, r.surf.contour creates a raster elevation map from a rasterized contour map. πΈ Elevation values are determined using procedures similar to a manual methods. (yes bestie, it's giving "we did this by hand once and it was a whole thing".)
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. that's the human version. π«Ά
r.surf.contour works in a similar way, and here's the tea: π
- Initially, a vector map of the contour lines is made with the elevation of each line as an attribute.
- When the program
v.to.rastis run on the vector map, continuous "lines" of rasters containing the contour line values will be the input forr.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. literally distance-based, no shortcuts π
ποΈ 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 containNULLvalues).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. π mask stays winning.
π NOTES π
r.surf.contour works well under the following circumstances, bestie, and I need you to hear me on these:
- the contour lines extend to 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. π no ma'am. Run r.slope.aspect on r.surf.contour results 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. π₯ fr fr, exponential. plan accordingly.
π 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
ate and left no crumbs πβ¨
π SEE ALSO π
r.mapcalcr.slope.aspectr.surf.idwwxGUI vector digitizerv.surf.idwv.surf.rstv.to.rast
Overview: Interpolation and Resampling in GRASS π¦
π AUTHOR π
Chuck Ehlschlaeger, U.S. Army Construction Engineering Research Laboratory
πΈ SOURCE CODE πΈ
Available at: r.surf.contour source code (history)
Latest change: Friday Aug 08 09:39:19 2025 in commit: ed72c71d8580e872cd6fd345c84a15c324764465
Main index | Raster index | Topics index | Keywords index | Graphical index | Full index
Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual
and that's the whole page bestie!! π«Ά this was r.surf.contour from the GRASS 8.5.0 family β go interpolate something gorgeous, and remember to check your resolution before you come for me ππ
π¦ where this page comes from
- alpine 3.24: grass-gis-doc 8.5.0-r1 Β· GPL-2.0-or-later
- ubuntu stonking: grass-doc 8.5.0-1ubuntu1 Β· 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