[R-sig-Geo] Plot (image( )) Real RGB Colors of an Imported GeoTIFF (readGDAL( ))

Edzer Pebesma edzer.pebesma at uni-muenster.de
Tue Jun 22 18:27:33 CEST 2010


Asssuming r g and b are on a 0 - 255 scale and form the first, second
and third band in obj, which was read through readGDAL, you could use

image(obj, red = 1, green = 2, blue = 3)

which is image { sp } and not image { graphics }. See also

library(sp)
?image.SpatialGridDataFrame

On 06/22/2010 03:57 PM, Rodrigo Aluizio wrote:
> Hi List members.
> 
> I’m actually able to import a Georeferenced image (.tiff) using readGDAL
> {rgdal} and plot it using image {Graphics}.
> 
> But the colors options available in the image function (topo.colors,
> heat.colors, terrain.colors, etc) aren’t able to adequately reproduce the
> original image. The tiff file represent land and ocean, so I need brow and
> green tones to land and blue tones to ocean. I was able to create the blue
> tones with colorRampPalette () but these blue tones are also applied to the
> land.
> 
> Once imported the object containing the raster georeferenced file brings
> three data columns with bands (RGB maybe) values of each cell (I guess).
> Isn’t there a way to reproduce the real colors using these columns
> information or any other way to do so?
> 
>  
> 
> Thank you on advance for the patience and help.
> 
>  
> 
> Below, some useful information on the object:
> 
>  
> 
>>
> BC<-readGDAL('C:/Users/Rodrigo/Documents/Shapefiles/Campos/BaciaCampos-GE-SA
> D69-LongLat.tiff')
> 
> C:/Users/Rodrigo/Documents/Shapefiles/Campos/BaciaCampos-GE-SAD69-LongLat.ti
> ff has GDAL driver GTiff 
> 
> and has 3350 rows and 3015 columns
> 
>  
> 
>> summary(BC)
> 
> Object of class SpatialGridDataFrame
> 
> Coordinates:
> 
>         min       max
> 
> x -42.15808 -39.58503
> 
> y -23.74079 -21.08709
> 
> Is projected: FALSE 
> 
> proj4string : [+proj=longlat +ellps=aust_SA +no_defs]
> 
> Number of points: 2
> 
> Grid attributes:
> 
>   cellcentre.offset     cellsize cells.dim
> 
> x         -42.15765 0.0008534147      3015
> 
> y         -23.74040 0.0007921499      3350
> 
> Data attributes:
> 
>      band1            band2            band3      
> 
>  Min.   :  0.00   Min.   :  0.00   Min.   :  0.0  
> 
>  1st Qu.: 48.00   1st Qu.: 67.00   1st Qu.: 95.0  
> 
>  Median : 70.00   Median : 89.00   Median :117.0  
> 
>  Mean   : 65.17   Mean   : 83.37   Mean   :117.7  
> 
>  3rd Qu.: 76.00   3rd Qu.: 97.00   3rd Qu.:150.0  
> 
>  Max.   :255.00   Max.   :255.00   Max.   :255.0
> 
>  
> 
> Regards
> 
>  
> 
> -------------------------------------------------------------
> 
> MSc.  <mailto:r.aluizio at gmail.com> Rodrigo Aluizio
> 
> Centro de Estudos do Mar/UFPR
> Laboratório de Micropaleontologia
> Avenida Beira Mar s/n - CEP 83255-000
> Pontal do Paraná - PR - Brasil
> 
> 
> 	[[alternative HTML version deleted]]
> 
> 
> 
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo

-- 
Edzer Pebesma
Institute for Geoinformatics (ifgi), University of Münster
Weseler Straße 253, 48151 Münster, Germany. Phone: +49 251
8333081, Fax: +49 251 8339763  http://ifgi.uni-muenster.de
http://www.52north.org/geostatistics      e.pebesma at wwu.de



More information about the R-sig-Geo mailing list