[GRASSLIST:4399] Re: local / global depression

Hamish hamish_nospam at yahoo.com
Wed Sep 22 21:20:20 EDT 2004

> I'm searching how to find directly the global (one and only one)
> minimum coordinates of a raster map.
> I can do that with r.fill.dir, and then display the map and
> find the coordinates of local minimum with the mouse
> and with  d.what.rast.
> But, 1) iIm not sure to get THE minimum of the map, 2) I would like
> to do it with a command (or a set of command).
> If anyone has a solution, I would enjoy to use it.

One way to do it:

#get minimum from 'r.info -r':
MINIMUM=`r.info -r $MAPNAME | grep min | cut -f2 -d=`

# create a coverage map (integer based, fp may need slight change)
r.mapcalc 'min_cells=if($MAPNAME == $MINIMUM, 1, null() )'

note the minimum value may occur at more than one place.

r.to.sites (5.0/5.3) or r.to.vect (5.7)

s.out.ascii (5.0/5.3) or v.out.ascii (5.7)


More information about the grass-user mailing list