[R-sig-Geo] Extract max.... es: PROBLEM writing geotiff

Rafael Wüest rafael.wueest at wsl.ch
Fri Mar 1 15:50:14 CET 2013


Hi Zia

try

# Writing tiff file:

tr <- "L://MODIS_DATA//NDVI/max.tif"
writeRaster(r,tr)

HTH
Rafael


On 01.03.2013, at 15:38, Zia Uddin Ahmed <zua3 at cornell.edu> wrote:

> 
> 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 at gmail.com<mailto:romunov at gmail.com> [mailto:romunov at gmail.com] On Behalf Of Roman Luštrik
> Sent: Friday, March 01, 2013 2:27 AM
> To: Zia Uddin Ahmed
> Cc: r-sig-geo at r-project.org<mailto:r-sig-geo at 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 at cornell.edu<mailto:zua3 at 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 at r-project.org<mailto:R-sig-Geo at r-project.org>
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
> 
> 
> 
> --
> In God we trust, all others bring data.
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo at r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo



--
Rafael Wüest
Swiss Federal Research Institute WSL
Zürcherstrasse 111
8903 Birmensdorf
Switzerland

+41 44 7392126
rafael.wueest at wsl.ch
http://www.wsl.ch/info/mitarbeitende/wueest/index_EN



More information about the R-sig-Geo mailing list