r.region(1grass)

πŸ’– r.region β€” a.k.a. the "let me fix your raster boundaries bestie" era πŸ’–

okay so real talk, this one is from the GRASS User's Manual, and it's literally the glow-up tool for raster map boundaries. No cap. Let's get into it 🫢

✨ NAME ✨

r.region β€” sets the boundary definitions for a raster map. that's it, that's the whole job, and she does it flawlessly πŸ’…

🌸 KEYWORDS 🌸

raster, metadata, geometry β€” the holy trinity, honestly

πŸ¦‹ SYNOPSIS πŸ¦‹

r.region
r.region --help
r.region [-cda] map=name  [region=name]   [raster=name]   [vector=name]
[n=value]   [s=value]   [e=value]   [w=value]   [align=name]   [--help]
[--verbose]  [--quiet]  [--ui]

πŸŽ€ Flags πŸŽ€

  • -c β€” set from the current region. yes queen, take what's already there
  • -d β€” set from the default region. the classic, the blueprint, the blueprint-y one
  • -a β€” auto-adjustment for lat/lon. she will attempt to fix small precision errors in resolution and extents, which is giving "I'll try my best" energy but honestly it usually eats
  • --help β€” print usage summary. your emergency contact fr fr
  • --verbose β€” verbose module output. she will NOT stop talking and honestly? we love that
  • --quiet β€” quiet module output. shhh era
  • --ui β€” force launching GUI dialog. for the visual learners 🎨

πŸ’œ Parameters πŸ’œ

  • map=name (required) β€” name of the raster map to change. this one is mandatory bestie, you cannot skip it, the tool will simply not engage
  • region=name β€” set region from a named region
  • raster=name β€” set region to match this raster map
  • vector=name β€” name of vector map; sets region to match this vector map
  • n=value β€” value for the northern edge
  • s=value β€” value for the southern edge
  • e=value β€” value for the eastern edge
  • w=value β€” value for the western edge
  • align=name β€” raster map to align to

🌈 DESCRIPTION 🌈

So the whole ~vibe~ of r.region is that it lets you manage the boundaries of a raster map. You can set those boundaries directly by hand, or you can pull them from:

  • a region definition file (which lives under the windows directory in the user's current mapset),
  • a raster map,
  • a vector map,
  • or a 3dview file.

And now, the align parameter β€” this is the main character. align sets the current resolution equal to that of the named raster map, and then aligns the boundaries to a row and column edge in that named map. Important caveat tho 🚨: alignment only moves the existing boundaries outward to the edges of the next nearest cell in the named raster map β€” not to the named map's edges. If that latter thing is what you're after, you need the raster=name option instead. so like, know the difference, iykyk πŸ’€


πŸ‘‘ NOTES πŸ‘‘

After all the updates have been applied, the raster map's resolution settings get recomputed from the boundaries and the number of rows and columns in the raster map. she recalcs herself, it's giving self-sufficient 🧚

Also! The n=value may also be specified as a function of its current value: n=n+value increases the current northing, while n=n-value decreases it. And yes, this same trick is also true for s=value, e=value, and w=value. relative math, periodt ✨


πŸ”₯ EXAMPLES πŸ”₯

Assign absolute coordinates to a map:

r.region map=mymap n=220750 s=220000 w=638300 e=639000

Shift a map (using offset β€” here by +100 map units in the NS direction, and -50 in the EW direction):

r.region map=mymap n=n+100 e=e-50 w=w-50 s=s+100

see how she just... slid over? iconic behavior honestly πŸ¦‹


πŸ’« SEE ALSO πŸ’«

r.support, g.region, v.transform

🌟 AUTHOR 🌟

Glynn Clements

Based upon g.region

πŸ“¦ SOURCE CODE πŸ“¦

Available at: r.region source code (history)

Latest change: Monday Feb 24 16:07:55 2025 in commit: 4ab71fd34113b347c3c86c736cd82ca0f6be1d4b

Main index | Raster index | Topics index | Keywords index | Graphical index | Full index


that's the whole page bestie, go forth and fix those boundaries πŸ’…

okay and for the cute sign-off: this whole thing is living under GRASS 8.5.0 (the Reference Manual, no less), Β© 2003-2026 GRASS Development Team β€” and the r.region(1grass) footer says GRASS 8.5.0 too, so she's consistent, she's committed, she's aligned 😌🫢

πŸ“¦ where this page comes from