1

I am trying to open a .tif file containing values for canopy height. In my code, the values read are in the range (0,255). However, the provider of the file believes the values are in the range (0,40) and probably my software (which is R) is expanding the values. Please help and suggest how to tackle this programming issue and get the desired range without expanding. See the lines I wrote to read the file.

remove(list=ls())
library(raster)
read_file<-as.matrix(raster("veght_Part_d_7.tif")) #filename of attached image
min(read_file)
max(read_file) # returns 255 but supposedly return 40

enter image description here canopy height values in tif format

2

1 Answer 1

3

This is a problem with your data, not r. I just opened the tif in arcgis to check in an alternative platform and the values are evenly distributed from 0 to 255, and do not concentrate at all between 0 and 40.

4
  • thanks for helping me on this, quick question: did u check the original file from weblink or sample file I uploaded?
    – Munish
    Jul 30, 2013 at 17:50
  • I used the weblink you provided, which yielded a monstrous (nearly 1gb tif)- almost choked my computer. Jul 30, 2013 at 18:35
  • thats great help, thanks for your support. sorry for the large file size.
    – Munish
    Jul 30, 2013 at 19:17
  • it's a 8 bit image. a canopy height data would normally be a float.
    – Arihant
    Jan 9, 2014 at 3:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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