0

I exported a categorical raster from R and loaded it into ArcMap to visualize it. However, the attribute table is greyed out.

Code In R: I first tell R that the values are factors by ratifying it.

lulc_1985.resam <- ratify(lulc_1985.resam)
rat1985 <- data.frame(
  ID= 1:11,
  LandCover = c("Deciduous","Cropland", "Settlement","Mixed Forest",
                "Scrubland","Barren Land","Wetlands","Plantations",
                "Coastal","Grassland","Evergreen")
)
levels(lulc_1985.resam)<- rat1985

The output of the above:

> lulc_1985.resam
class       : RasterLayer 
dimensions  : 203, 192, 38976  (nrow, ncol, ncell)
resolution  : 1000, 1000  (x, y)
extent      : 628560.6, 820560.6, 1084984, 1287984  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=utm +zone=43 +datum=WGS84 +units=m +no_defs +ellps=WGS84 +towgs84=0,0,0 
data source : in memory
names       : layer 
values      : 1, 11  (min, max)
attributes  :
       ID LandCover
 from:  1 Deciduous
 to  : 11 Evergreen

As you can see above, the attributes exist here. Now I export the same out of R:

writeRaster(lulc_1985.resam,"E:\\lulc_1985.tif", format="GTiff")

The raster is now visualized in ArcMap, where the attribute table is greyed out.

enter image description here

How do I retrieve this attribute table?

The exported .tif is just 13kb in size.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.