[GRASS-user] Classes names in rasters
Nikos Alexandris
nik at nikosalexandris.net
Wed Oct 9 08:12:18 PDT 2013
On Wednesday 09 of October 2013 12:27:44 Luisa Peña wrote:
> Dear all,
> I have produced a raster map with landcover classes and I wanted to know if
> it is possible to have raster names instead of numeric values when I use
> the point-and-click options or even when I export as Geotiff?
> Thanks
> Regards,
> Luisa
You can try r.category, for example:
r.category Classification_Post rules=classes_description.rules
Where "classes_description" is a simple text file that might look like:
--%<---
1:2:Water
3:4:Water (Near Coast)
5:6:Water (Along Coast)
7:9:10:12:14:18:Shallow Water, Coast, Wet Ground
8:16:17:Urban
11:15:Some Vegetation
13:Shadows
19:22:Wet Ground
20:21:23:24:25:27:Some Vegetation 2
26:30:Other Vegetation (Low/Urban Green), incl. Some Bare Ground
28:29:Other Vegetation
--->%--
Have a look at the manual for details. You can then use r.report to produce a
nice summary, e.g.
r.report Classification_Post units=h -nh pw=60
would give:
+----------------------------------------------------------+
| Category Information | |
| #|description | hectares|
|----------------------------------------------------------|
| 1|2:Water. . . . . . . . . . . . . . . . . . .| 98.664200|
| 2| . . . . . . . . . . . . . . . . . . . . . .| 5.367125|
| 3|4:Water (Near Coast) . . . . . . . . . . . .| 0.212725|
| 4| . . . . . . . . . . . . . . . . . . . . . .| 0.333175|
| 5|6:Water (Along Coast). . . . . . . . . . . .| 0.317275|
| 6| . . . . . . . . . . . . . . . . . . . . . .| 0.536275|
....
...
..
.
Nikos
More information about the grass-user
mailing list