[GRASS-user] Location of minimum value in raster

Hamish hamish_b at yahoo.com
Wed Aug 3 08:54:32 EDT 2011


Joshua wrote:
> Is there a convenient way to find the location of the
> minimum value in a raster, either as x,y coordinates or as a
> binary raster (1 = minimum, 0 = other)? I've looked, but
> haven't found anything obvious.

two steps,
eval `r.info -r data_map` to get min=
r.mapcalc "binary_map = if(data_map == $min, 1, 0)"

or perhaps min from 'r.info -r' and coord(s) from grep'ing
output of 'r.stats -1g'.

perhaps you need to do "abs(data_map - $min) < 0.0000001" for
the equivalence test in r.mapcalc, or some similar awk test
from the printf() formatted output of r.stats.

perhaps you need to do r.buffer from the binary map to make the
single pixel(s) easier to locate.

d.rast with the cat or value list option might quickly do it too,
but a single cell might not visibly render.


Hamish



More information about the grass-user mailing list