Hi Zia,
 
instead of writeGDAL you can use the writeRaster function:
r<-writeRaster(r,tr,options="TFW=YES")
Matteo

>>> Zia Uddin Ahmed <zua3@cornell.edu> 01.03.2013 15:38 >>>

Thanks everybody. It works fine with following codes for extracting 
max value from list from a huge data set (max pixel value of  NDVI from
May to August  for CO, NM, WY and KS states) .  But I have a problem
with writing a  geotiff file. This is first time I am working with
rgdal. I was looking for   appropriate code in R-sig-Geo
Archives<https://stat.ethz.ch/pipermail/r-sig-geo/> for solving this
problem.  But I do not find any possible solution for doing this (may be
it is due to my limiting   understanding of  rgdal working environment).
Any suggestion will be appreciated.
Thanks again
Zia

rm(list=ls(all=TRUE))
# Get Max values
library(raster)
library(rgdal)

setwd("L:/MODIS_DATA/NDVI")
files <- list.files(pattern='.tif$')

s <- stack(files)
r <- max(s)
str(r)
plot(r)

# Writing tiff file:

tr <- "L://MODIS_DATA//NDVI/max.tif"
writeGDAL(r, tf, drivername="GTiff", options="TFW=YES")

“Error in function (classes, fdef, mtable)  :
  unable to find an inherited method for function ‘gridded’ for
signature ‘"RasterLayer"’”





From: romunov@gmail.com<mailto:romunov@gmail.com>
[mailto:romunov@gmail.com] On Behalf Of Roman Luštrik
Sent: Friday, March 01, 2013 2:27 AM
To: Zia Uddin Ahmed
Cc: r-sig-geo@r-project.org<mailto:r-sig-geo@r-project.org>
Subject: Re: [R-sig-Geo] Extract max. pixel value from a set geoTif
raster image and create a new geoTIF image with these max values

Yes. You will also want to install rgdal, if you haven't already. You
can read and write files with readOGR() and writeOGR(), while raster
functions are quite intuitive to work with. See raster package vignette
and drop us a line if you have any more questions.

Cheers,
Roman


On Fri, Mar 1, 2013 at 3:24 AM, Zia Uddin Ahmed
<zua3@cornell.edu<mailto:zua3@cornell.edu>> wrote:
       Dear list,
       I like to  extract  max. pixel value from a set  geoTif raster
image and create a new geoTIf  image  with these max values. Is it
possible to do this with R "raster" package?
       Thanks
       Zia


_______________________________________________
R-sig-Geo mailing list
R-sig-Geo@r-project.org<mailto:R-sig-Geo@r-project.org>
https://stat.ethz.ch/mailman/listinfo/r-sig-geo



--
In God we trust, all others bring data.

[[alternative HTML version deleted]]


	[[alternative HTML version deleted]]

