[GRASS-user] SQL: generating numeric class numbers from class text labels?

Markus Neteler neteler at osgeo.org
Wed Dec 4 09:11:47 PST 2019


Hi,

I have a landuse map with text labels (forest, street, ...). For
r.learn.ml I need to have them as numeric classes.
It is not important for me which number is assigned but I search for
an automated solution, i.e. SQL statement unless there is a different
way.

So:

cat|label|label_int
1|forest|1
2|forest|1
3|street|2
4|forest|1
5|street|2
6|urban|3
...

I guess I have done that already some years ago but I can't remember
the trick :-)

thanks for a hint,
Markus


More information about the grass-user mailing list