[R-sig-Geo] issue when opening raster image in R, the pixel values a rescaled somehow

Roger Bivand Roger@B|v@nd @end|ng |rom nhh@no
Tue Mar 24 09:47:31 CET 2020


Please put the original file on the link too, so that we can track where 
the misconfiguration occurs, and provide more of the workflow code. I 
think we'll also need sessionInfo() output and GDAL version, both as seen 
by gdalUtils, raster and rgdal.

Roger

On Tue, 24 Mar 2020, Victor F. Rodriguez Galiano wrote:

> Hi Roger, the link to he image is given below. This image was generated
> from a .hdf file using the function gdal_translate.
>
> gdal_translate(sds[1], dst_dataset=paste0(substr(filename, 1,
> nchar(filename)-4) ,".tif", ))
>
> https://wetransfer.com/downloads/4569e9a85c02faad5016b83d0b50217820200324084015/f2eafdfafaae74de9ac8e25017fc5cc520200324084015/e46e80
>
>
> Thanks
>
> Victor
>
> El lun., 23 mar. 2020 a las 21:07, Roger Bivand (<Roger.Bivand using nhh.no>)
> escribió:
>
>> Please make the file in question available for download (url), or the url
>> you downloaded it from (no login), on this list. It looks as though the
>> unsigned 16 bit integer is not right.
>>
>> Roger Bivand
>> Norwegian School of Economics
>> Bergen, Norway
>>
>> ------------------------------
>> *Fra:* R-sig-Geo <r-sig-geo-bounces using r-project.org> på vegne av Victor F.
>> Rodriguez Galiano <vrgaliano using gmail.com>
>> *Sendt:* mandag 23. mars 2020, 21.02
>> *Til:* r-sig-geo using r-project.org
>> *Emne:* [R-sig-Geo] issue when opening raster image in R, the pixel
>> values a rescaled somehow
>>
>> I opened a Geotiff image in R using the raster function. However, the
>> image seems to be rescaled. The minimum and maximum values should be 13607
>> and 15461 but are 275 and 305. The Geotiff image when opened in a GIS is
>> correct but not in R. This is my code: Script: library(raster)
>> trial<-raster("MOD11A2.A2000049.h17v05.006.2015058135048.tif", datatype =
>> "INT2U") trial plot(trial) [[alternative HTML version deleted]]
>> _______________________________________________ R-sig-Geo mailing list
>> R-sig-Geo using r-project.org https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>

-- 
Roger Bivand
Department of Economics, Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; e-mail: Roger.Bivand using nhh.no
https://orcid.org/0000-0003-2392-6140
https://scholar.google.no/citations?user=AWeghB0AAAAJ&hl=en


More information about the R-sig-Geo mailing list