[GRASS-user] saving patch areas on raster maps

Dear all,

I generated a clump map from my cover map, and computed the area of each patch using r.stats.
Now I need generate a map which values is the area for each clump.

Suggestions are welcome.

Best regards,

miltinho astronatua
brazil

You can use r.recode to do this, but you’ll need to reformat the output from r.stats.

Example:

r.stats -a -n

0 1234
1 2345
2 3456

This needs to be:

0:0:1234:1234
1:1:2345:2345
2:2:3456:3456

Save this to a txt file and use it with the rules flag of r.recode. If you have a large amount of categories, I would suggest using awk or perl to reformat the r.stats output.

-Jamie

On Fri, Nov 14, 2008 at 8:22 AM, Milton Cezar Ribeiro <miltinho.astronauta@gmail.com> wrote:

Dear all,

I generated a clump map from my cover map, and computed the area of each patch using r.stats.
Now I need generate a map which values is the area for each clump.

Suggestions are welcome.

Best regards,

miltinho astronatua
brazil


grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

Milton wrote:

> I generated a clump map from my cover map, and computed the area of each
> patch using r.stats.
> Now I need generate a map which values is the area for each clump.

Jamie Adams wrote:

You can use r.recode to do this, but you'll need to
reformat the output from r.stats.

another way is set areas as r.category labels, then create a new map
from the labels using r.mapcalc's @ operator. Again, perhaps some
reformatting is needed with awk etc. to rearrange column order?

Hamish

Dear all,

Thanks for all tips.
The code below worked fine. As my map is in meters, I saved the wanted AREA OF CLUMPs in hectare.

r.stats -na input=clump_map | awk ‘{print $1,“=”,$2/10000}’|r.reclass input=clump_map output=clump_map_AreaHA -

All the best, for all.

miltinho
brazil

2008/11/16 Hamish <hamish_b@yahoo.com>

Milton wrote:

I generated a clump map from my cover map, and computed the area of each
patch using r.stats.
Now I need generate a map which values is the area for each clump.

Jamie Adams wrote:

You can use r.recode to do this, but you’ll need to
reformat the output from r.stats.

another way is set areas as r.category labels, then create a new map
from the labels using r.mapcalc’s @ operator. Again, perhaps some
reformatting is needed with awk etc. to rearrange column order?

Hamish