r.info
Outputs basic information about a raster map.
r.info [-grseh] map=name [format=name] [--verbose] [--quiet] [--qq] [--ui]
Example:
r.info map=name
grass.script.parse_command("r.info", map, format=None, flags=None, verbose=False, quiet=False, superquiet=False)
Example:
gs.parse_command("r.info", map="name", format="json")
Parameters
map=name [required]
Name of raster map
format=name
Output format
Allowed values: plain, shell, json
plain: Human readable text output
shell: shell script style text output
json: JSON (JavaScript Object Notation)
-g
Print raster array information
-r
Print range
-s
Print stats
-e
Print extended metadata information
-h
Print raster history instead of info
--help
Print usage summary
--verbose
Verbose module output
--quiet
Quiet module output
--qq
Very quiet module output
--ui
Force launching GUI dialog
map : str, required
Name of raster map
Used as: input, raster, name
format : str, optional
Output format
Used as: name
Allowed values: plain, shell, json
plain: Human readable text output
shell: shell script style text output
json: JSON (JavaScript Object Notation)
flags : str, optional
Allowed values: g, r, s, e, h
g
Print raster array information
r
Print range
s
Print stats
e
Print extended metadata information
h
Print raster history instead of info
verbose: bool, optional
Verbose module output
Default: False
quiet: bool, optional
Quiet module output
Default: False
superquiet: bool, optional
Very quiet module output
Default: False
DESCRIPTION
r.info reports some basic information about a user-specified raster map layer. This map layer must exist in the user's current mapset search path. Information about the map's boundaries, resolution, projection, data type, category number, project, mapset, project parent directory (database directory), the timestamp and history are put into a table and written to standard output. The types of information listed can also be found in the cats, cellhd, and hist directories under the mapset in which the named map is stored.
The user can save the tabular output to a file by using the UNIX redirection mechanism (>); for example, the user might save a report on the soils map layer in a file called soil.txt by typing:
r.info map=soils > soil.txt
NOTES
On large maps, the total number of cells in the map may not be displayed with an accurate number. This is only cosmetic.
Some standards (ISO-C90) and compilers do not support the 'long long' type as a 64-bit type. In the case that GRASS was built with such a compiler, an accuracy message may be displayed in the output of r.info after Total Cells.
For backwards compatibility reasons, using flags -g, -e, -r, -s without format, automatically switches to the shell format. In the next major release, this may be changed to keep the plain format output to best serve interactive use. Specify format shell or json explicitly for scripting.
EXAMPLES
Get full report
Below is a full report produced by r.info for the raster map slope in the North Carolina sample data base:
r.info slope
Possible output:
+----------------------------------------------------------------------------+
| Map: slope Date: Tue Nov 7 01:11:23 2006 |
| Mapset: PERMANENT Login of Creator: helena |
| Project: nc_spm_08_grass7 |
| DataBase: /grassdata |
| Title: South-West Wake county: slope in degrees ( slope_ned10m ) |
| Timestamp: none |
|----------------------------------------------------------------------------|
| |
| Type of Map: raster Number of Categories: 255 |
| Data Type: FCELL |
| Rows: 1350 |
| Columns: 1500 |
| Total Cells: 2025000 |
| Projection: Lambert Conformal Conic |
| N: 228500 S: 215000 Res: 10 |
| E: 645000 W: 630000 Res: 10 |
| Range of data: min = 0 max = 38.68939 |
| |
| Data Source: |
| raster elevation file elev_ned10m |
| |
| |
| Data Description: |
| generated by r.slope.aspect |
| |
| Comments: |
| slope map elev = elev_ned10m |
| zfactor = 1.00 format = degrees |
| min_slope = 0.000000 |
| |
+----------------------------------------------------------------------------+
import grass.script as gs
data = gs.parse_command("r.info", map="slope", format="json")
print(data["title"])
Possible output:
South-West Wake county: slope in degrees
The whole JSON may look like this:
{
"north": 228500,
"south": 215000,
"nsres": 10,
"east": 645000,
"west": 630000,
"ewres": 10,
"rows": 1350,
"cols": 1500,
"cells": 2025000,
"datatype": "FCELL",
"ncats": 255,
"min": 0,
"max": 38.68939208984375,
"n": 2019304,
"mean": 3.864522406673347,
"stddev": 3.0079141222181214,
"sum": 7803645.5538851162,
"map": "slope",
"maptype": "raster",
"mapset": "PERMANENT",
"location": "nc_spm_08_grass7",
"project": "nc_spm_08_grass7",
"database": "/grassdata",
"date": "Tue Nov 7 01:11:23 2006",
"creator": "helena",
"title": "South-West Wake county: slope in degrees",
"timestamp": null,
"units": null,
"vdatum": null,
"semantic_label": null,
"source1": "raster elevation file elev_ned10m",
"source2": "",
"description": "generated by r.slope.aspect",
"comments": "slope map elev = elev_ned10m\nzfactor = 1.00 format = degrees\nmin_slp_allowed = 0.000000"
}
Alternatively, the output from r.info may be confined to a more terse subset of the available information by passing various flags to the module:
Get raster array information
r.info -g slope format=shell
Possible output:
north=228500
south=215000
east=645000
west=630000
nsres=10
ewres=10
rows=1350
cols=1500
cells=2025000
datatype=FCELL
ncats=255
import grass.script as gs
data = gs.parse_command("r.info", map="slope", flags="g", format="json")
print(data)
Possible output:
{'north': 228500, 'south': 215000, 'nsres': 10, 'east': 645000, 'west': 630000, 'ewres': 10, 'rows': 1350, 'cols': 1500, 'cells': 2025000, 'datatype': 'FCELL', 'ncats': 255}
Output in shell script style, useful for eval
(eval `r.info -g slope format=shell`
):
Get the map data range
r.info -r slope format=shell
Possible output:
min=0
max=38.68939
import grass.script as gs
data = gs.parse_command("r.info", map="slope", flags="r", format="json")
print(data)
Possible output:
{'min': 0, 'max': 38.68939208984375}
Get extended metadata information
r.info -e slope format=shell
Possible output:
map=slope
mapset=PERMANENT
location=nc_spm_08_grass7
project=nc_spm_08_grass7
database=/grassdata
date="Tue Nov 7 01:11:23 2006"
creator="helena"
title="South-West Wake county: slope in degrees (slope_ned10m)"
timestamp="none"
units="none"
vdatum="none"
semantic_label="none"
source1="raster elevation file elev_ned10m"
source2=""
description="generated by r.slope.aspect"
comments="slope map elev = elev_ned10mzfactor = 1.00 format = degreesmin_slp_allowed = 0.000000"
import grass.script as gs
data = gs.parse_command("r.info", map="slope", flags="e", format="json")
print(data["title"])
Possible output:
South-West Wake county: slope in degrees
The whole JSON may look like this:
{
"map": "slope",
"maptype": "raster",
"mapset": "PERMANENT",
"location": "nc_spm_08_grass7",
"project": "nc_spm_08_grass7",
"database": "/grassdata",
"date": "Tue Nov 7 01:11:23 2006",
"creator": "helena",
"title": "South-West Wake county: slope in degrees",
"timestamp": null,
"units": null,
"vdatum": null,
"semantic_label": null,
"source1": "raster elevation file elev_ned10m",
"source2": "",
"description": "generated by r.slope.aspect",
"comments": "slope map elev = elev_ned10m\nzfactor = 1.00 format = degrees\nmin_slp_allowed = 0.000000"
}
SEE ALSO
g.mapsets, r.coin, r.describe, r.report, r.stats, r.support, r.univar, r.what
AUTHOR
Michael O'Shea, U.S. Army Construction Engineering Research Laboratory
SOURCE CODE
Available at: r.info source code
(history)
Latest change: Friday Jun 13 02:52:53 2025 in commit 2792780