|
How about doing this in R? The labels will be read into R as factors, and the factor levels can easily be extracted as numbers.
Something like this:
micha@tp480:~$ v.info -c stations
micha@tp480:~$ R
R version 3.5.2 (2018-12-20) -- "Eggshell Igloo" > stations['new_station_num'] =
as.numeric(stations$station_en) > writeVECT(SDF=stations, vname="new_stations") Best regards, Micha
On 04/12/2019 19:11, Markus Neteler
wrote:
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 _______________________________________________ grass-user mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/grass-user -- Micha Silver Ben Gurion Univ. Sde Boker, Remote Sensing Lab cell: +972-523-665918 https://orcid.org/0000-0002-1128-1325 |
_______________________________________________ grass-user mailing list [email protected] https://lists.osgeo.org/mailman/listinfo/grass-user
