3

I have a .tif file (about 380 mb) that I am trying to load in R and plot.

file<-raster('tiffname.tif')

It is a formal class Raster Layer with the following information

class       : RasterLayer 
dimensions  : 40000, 40000, 1.6e+09  (nrow, ncol, ncell)
resolution  : 0.00025, 0.00025  (x, y)
extent      : 80, 90, 30, 40  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84+towgs84=0,0,0 
data source : \Data\trial\tiffname.tif 
names       : X40N_080E_mtc02 

Why are there no values for this tif file? Is that why I am unable to plot it?

closed as unclear what you're asking by Spacedman, whyzar, xunilk, MaryBeth, BERA Feb 28 '18 at 5:59

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • What tells you there are no values for this tif file? Some error message? – Spacedman Feb 27 '18 at 14:49
  • @Spacedman Usually there is a values row after names that gives the min and the max pixel values, which is not here. There is no error message and I do not get a plot for the tif file when I use plot (file) – tg110 Feb 27 '18 at 14:51
  • @tg110 what does getValues(file) produce? – Marco Feb 27 '18 at 15:03
2

Please try this to see if you get the values row:

#load raster
file<-raster('tiffname.tif')
file <- setMinMax(file)
#print raster attributes
file
  • 1
    Shouldn't setMinMax be applied to a RasterLayer class? so first file<-raster('tiffname.tif') and then file <- setMinMax(file) – Marco Feb 27 '18 at 15:12
  • You are totally right. Fixed. – Iridium Feb 27 '18 at 15:13

Not the answer you're looking for? Browse other questions tagged or ask your own question.