Re: [GRASS-user] using label in r.mapcalc query?
Ahmet Temiz wrote: > I am confused about using label values in r.mapcalc. > > r.category curvt_cat > 1 conc > 2 flat > 3 conx > > > r.mapcalc "dene = if ( curvt_cat == /* I want to use label values here > instead of categories*/ )" > > like this : > > r.mapcalc "dene = if ( curvt_cat == 'conc' )" > > it gives > Invalid map > > ?How can I use label in r.mapcalc query?? You can't. r.mapcalc doesn't have a string type. You'll need to parse the output from r.category to determine the numeric category corresponding to the label, then use that in the r.mapcalc expression. The @ modifier reads the category label and converts it to a float. This is basically a hack which had some utility in the GRASS 4.x era, before GRASS supported floating-point maps. -- Glynn Clements___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
Re: [GRASS-user] using label in r.mapcalc query
Hei Ahmet, Please have a look here: https://grass.osgeo.org/grass70/manuals/r.mapcalc.html#raster-map-layer-values-from-the-category-file You might try: r.mapcalc "dene = if ( @curvt_cat == 'conc' )" but I doubt that it will work, as what I understood from the manual is that the “@” operator only returns floating point values (and not text) and will return NULL for non-numeric lables. Since you have both categories and labels why not using the categories? Cheers Stefan From: grass-user [mailto:grass-user-boun...@lists.osgeo.org] On Behalf Of Ahmet Temiz Sent: 14. oktober 2016 09:57 To: User grass <grass-user@lists.osgeo.org> Subject: [GRASS-user] using label in r.mapcalc query Hi, I am confused about using label values in r.mapcalc. r.category curvt_cat 1 conc 2 flat 3 conx r.mapcalc "dene = if ( curvt_cat == /* I want to use label values here instead of categories*/ )" like this : r.mapcalc "dene = if ( curvt_cat == 'conc' )" it gives Invalid map How can I use label in r.mapcalc query? regards -- Ahmet Temiz Jeoloji Müh. Afet ve Acil Durum Yönetimi Başkanlığı Bilgi İşlem Dairesi Başkanlığı-CBS Grubu Ahmet Temiz Geological Eng. Information Systems - GIS Group Disaster and Emergency Management of Presidency ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user
[GRASS-user] using label in r.mapcalc query
Hi, I am confused about using label values in r.mapcalc. r.category curvt_cat 1 conc 2 flat 3 conx r.mapcalc "dene = if ( curvt_cat == /* I want to use label values here instead of categories*/ )" like this : r.mapcalc "dene = if ( curvt_cat == 'conc' )" it gives Invalid map How can I use label in r.mapcalc query? regards -- Ahmet Temiz Jeoloji Müh. Afet ve Acil Durum Yönetimi Başkanlığı Bilgi İşlem Dairesi Başkanlığı-CBS Grubu Ahmet Temiz Geological Eng. Information Systems - GIS Group Disaster and Emergency Management of Presidency ___ grass-user mailing list grass-user@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/grass-user