d.rast.edit(1grass)
β¨ d.rast.edit β¨
okay bestie, gather round β this is d.rast.edit, from the GRASS User's Manual, and it's literally the glow-up your raster map has been waiting for π
π NAME π
d.rast.edit β edits cell values in a raster map. that's it, that's the whole vibe. cell values? edited. π
π KEYWORDS π
display, editing, raster
πΈ SYNOPSIS πΈ
d.rast.edit
d.rast.edit --help
d.rast.edit input=name output=name [aspect=name] [width=integer]
[height=integer] [size=integer] [rows=integer] [cols=integer]
[--overwrite] [--help] [--verbose] [--quiet] [--ui]
π© Flags π©
--overwriteβ let your output files just bulldoze over existing files. yes, full permission to overwrite, no cap.--helpβ prints the usage summary so you're not out here guessing π«Ά--verboseβ verbose module output, aka the module will overshare (affectionate)--quietβ quiet module output. shhh. π€«--uiβ forces the GUI dialog to launch, main character energy only
π§ Parameters π§
input=name[required] β the name of the input raster map (the one you're editing, duh)output=name[required] β the name for your output raster map β¨aspect=nameβ name of input aspect raster mapwidth=integerβ width of the display canvas. Default:640height=integerβ height of the display canvas. Default:480size=integerβ minimum size of each cell. Default:12rows=integerβ maximum number of rows to load. Default:100cols=integerβ maximum number of columns to load. Default:100
π DESCRIPTION π
so d.rast.edit lets you interactively edit cell category values in a raster map layer, and it shows that layer up on the graphics monitor so you can poke at it with a mouse cursor. yes, with your actual hands. iconic. π±οΈβ¨
π Overview window π
there's an overview window that shows the entire map, with a red box showing the current editing region. the edit window is the one showing the cells inside the selected area. want to move your editing area? just click a new spot on the overview window and boom, you're there. π¦
ποΈ Raster cell editing ποΈ
cell editing happens with the mouse cursor β you point at the cell(s) on the displayed raster map that you want to edit.
to change a cell's value, drop the new value you want into the "New value" box at the bottom left of the edit window. a value of * means a NULL value should be used.
Important: the new value in the "New value" box must be confirmed with Enter, otherwise it is not yet active. not yet. it's just sitting there. waiting. π
πΎ Saving the edited map πΎ
to save your edited map, the "File" menu has an entry called Save. to leave d.rast.edit, use Exit in the menu. bye bestie π
β¨οΈ Map pan with arrow keys β¨οΈ
the map can be shifted using the arrow keys on the keyboard. arrow key supremacy. π₯
π NOTES π
there is no "undo" command, and there's no way to exit edit mode without saving changes to the output map. so like... be sure. fr fr. π
a raster mask in place will be respected both when reading the original raster map layer and when writing the new raster map layer, which means any edits to the masked areas will be ignored. the mask said no. π
π Geographic Region Concerns π
d.rast.edit reads the region definition for the raster map layer being edited from its internal cell header file. the new, edited copy of the raster layer gets created with the same resolution and region dimensions. periodt.
the primary bane of the d.rast.edit program involves large map layers (with lots of rows and columns) and/or slow computers, since the program must read and write raster map layers row by row for the full size of the map layer as dictated by its region size and resolution. (the current region settings of north, south, east, and west will not limit the size of the edited copy of the map layer, because by use of the overview selection these values may change several times during the editing session). so yeah. slow computer + big map = pain. π
β EXAMPLE β
editing raster values in a LiDAR DEM, North Carolina sample data:
g.region raster=elev_lid792_1m -p
# pan to area of interest and edit raster cells (I used "102" as value to modify cells
# Use: File > Save to save
# then: File > Exit
d.rast.edit input=elev_lid792_1m output=elev_lid792_1m_modified
# comparison of raster statistics
# original stats, note the min value
r.univar -g elev_lid792_1m
# modified map stats, note the min value
r.univar -g elev_lid792_1m_modified
Figure: Editing of pixels in an elevation raster map using d.rast.edit
π§ TODO π§
d.rast.edit should not create a new raster map layer if the user makes no cell edits while running the program and leaving it without saving. (it should just... not. bestie behavior.)
it would be nice to incorporate a scrollable version of d.legend (such that one could see a label legend for files with many categories on a standard size sub-frame). it would be even nicer to be able to select the category values from a graphical legend when editing cell values (thereby saving a trip to the text frame to type in the new value). imagine the convenience. obsessed. π
perhaps method(s) for multiple or mass cell edits would be useful. this could be done by providing modes in which the user may:
- edit a block of cells to a given value by drawing a box;
- be able to choose a given value which is automatically used as the new value on each cell chosen until a different value is desired.
β οΈ there is no user-interrupt handling. this could leave files in .tmp or (rarely) result in half-baked raster maps. the original file would survive unscathed by an interrupt at most any point in execution. beware of exiting the program by means other than using exit on the Main Menu. β οΈ
π SEE ALSO π
d.rast.arrow, d.rast.num, wxGUI.rdigit
π AUTHORS π
Tcl/Tk (2007) and wxPython versions (2008): Glynn Clements
Replaces Xdriver version in C by Chris Rewerts, April 1991, Agricultural Engineering, Purdue University
π SOURCE CODE π
Available at: d.rast.edit source code (history)
Latest change: Wednesday Feb 12 23:02:46 2025 in commit: 9c1146064f7c3c21fb0746063fa8bd2cdf4633cb
Main index | Display index | Topics index | Keywords index | Graphical index | Full index
okay that's the whole thing, you're fully caught up π«Ά this was GRASS 8.5.0, d.rast.edit(1grass), and the manual itself is Β© 2003-2026 GRASS Development Team, GRASS 8.5.0 Reference Manual. go edit some cells, bestie β and for the love of everything, save before you exit. no undo, remember? π
π¦β¨
π¦ 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