[R-sig-eco] Generate Geotiff with colors

Marc Girondot marc_grt at yahoo.fr
Sat Feb 1 06:20:13 CET 2014


Dear colleagues,

I try to generate a geotiff in R. It works except that the tif file has 
no color when I open it in QGis.

Here is the R code:
library("dismo", "rgdal", "raster")
# define a Nigeria region
e <-  extent( 3.25 , 3.35 , 6.38 , 6.48 )
# get the image from GoogleMap server
r1 <- gmap(e, lonlat=TRUE)
# plot the map, colors are present
plot(r1) # first problem... why the black lines around the image. They 
are not present if I use lonlat=FALSE
# save it in geotiff
writeRaster(r1, filename="maps/raster1.tif", format="GTiff", overwrite=TRUE)

And when I open it in Qgis, it has no color...

Any ideas ?

Thanks a lot

Marc



More information about the R-sig-ecology mailing list