Skip to main content
Added files to reproduce behavior and clarifications
Source Link
qdread
  • 283
  • 3
  • 14

I am interested in the terra R package as it appears to be a successor to the raster package that is being more actively developed than the raster package. But it seems like some features are missing.

For example I have an aggregated National Landcover Dataset raster in .GRD format.

If I call x <- raster::raster('nlcd_agg.grd') the resulting object has a slot x@data@attributes with the raster attribute table that includes the names of the land cover types corresponding to the integer values in the raster.

However if I call x <- terra::rast('nlcd_agg.grd') I cannot find that attribute table in the object nor do I see how to associate the object x with the attribute table of the raster.

I would like to be able to load the raster and have the associated attribute table with land cover type names and default plotting colors load as well. I understand that .GRD is a native format for the raster package but is there some way to achieve this with the terra or stars packages?

Here are two small files that can replicate the behavior (nlcd_agg.grd and the associated nlcd_agg.gri):

I am interested in the terra R package as it appears to be a successor to the raster package that is being more actively developed than the raster package. But it seems like some features are missing.

For example I have an aggregated National Landcover Dataset raster in .GRD format.

If I call x <- raster::raster('nlcd_agg.grd') the resulting object has a slot x@data@attributes with the raster attribute table that includes the names of the land cover types corresponding to the integer values in the raster.

However if I call x <- terra::rast('nlcd_agg.grd') I cannot find that attribute table in the object nor do I see how to associate the object x with the attribute table of the raster.

I am interested in the terra R package as it appears to be a successor to the raster package that is being more actively developed than the raster package. But it seems like some features are missing.

For example I have an aggregated National Landcover Dataset raster in .GRD format.

If I call x <- raster::raster('nlcd_agg.grd') the resulting object has a slot x@data@attributes with the raster attribute table that includes the names of the land cover types corresponding to the integer values in the raster.

However if I call x <- terra::rast('nlcd_agg.grd') I cannot find that attribute table in the object nor do I see how to associate the object x with the attribute table of the raster.

I would like to be able to load the raster and have the associated attribute table with land cover type names and default plotting colors load as well. I understand that .GRD is a native format for the raster package but is there some way to achieve this with the terra or stars packages?

Here are two small files that can replicate the behavior (nlcd_agg.grd and the associated nlcd_agg.gri):

naming; removed TIA
Source Link
Vince
  • 20.3k
  • 16
  • 48
  • 65

Attribute table in rR terra package?

I am interested in the terra R package as it appears to be a successor to the raster package that is being more actively developed than the raster package. But it seems like some features are missing.

For example I have an aggregated National Landcover Dataset raster in .GRD format.

If I call x <- raster::raster('nlcd_agg.grd') the resulting object has a slot x@data@attributes with the raster attribute table that includes the names of the land cover types corresponding to the integer values in the raster.

However if I call x <- terra::rast('nlcd_agg.grd') I cannot find that attribute table in the object nor do I see how to associate the object x with the attribute table of the raster.

Thanks in advance for the help.

Attribute table in r terra package?

I am interested in the terra R package as it appears to be a successor to the raster package that is being more actively developed than the raster package. But it seems like some features are missing.

For example I have an aggregated National Landcover Dataset raster in .GRD format.

If I call x <- raster::raster('nlcd_agg.grd') the resulting object has a slot x@data@attributes with the raster attribute table that includes the names of the land cover types corresponding to the integer values in the raster.

However if I call x <- terra::rast('nlcd_agg.grd') I cannot find that attribute table in the object nor do I see how to associate the object x with the attribute table of the raster.

Thanks in advance for the help.

Attribute table in R terra package?

I am interested in the terra R package as it appears to be a successor to the raster package that is being more actively developed than the raster package. But it seems like some features are missing.

For example I have an aggregated National Landcover Dataset raster in .GRD format.

If I call x <- raster::raster('nlcd_agg.grd') the resulting object has a slot x@data@attributes with the raster attribute table that includes the names of the land cover types corresponding to the integer values in the raster.

However if I call x <- terra::rast('nlcd_agg.grd') I cannot find that attribute table in the object nor do I see how to associate the object x with the attribute table of the raster.

Source Link
qdread
  • 283
  • 3
  • 14

Attribute table in r terra package?

I am interested in the terra R package as it appears to be a successor to the raster package that is being more actively developed than the raster package. But it seems like some features are missing.

For example I have an aggregated National Landcover Dataset raster in .GRD format.

If I call x <- raster::raster('nlcd_agg.grd') the resulting object has a slot x@data@attributes with the raster attribute table that includes the names of the land cover types corresponding to the integer values in the raster.

However if I call x <- terra::rast('nlcd_agg.grd') I cannot find that attribute table in the object nor do I see how to associate the object x with the attribute table of the raster.

Thanks in advance for the help.