Komine,

You're passing a path to crop, but you should pass your raster object. (see
?crop)

Try :
library(raster)
myobject <-
raster("C:\\Users\\komine\\Desktop\\MODIS\\MYD09GQ.A2010280.h16v07.005.2010282160347.sur_refl_b01_1.tif")
e <- extent(-90, -32, -60, 15)
r <- crop(myobject,e)
plot(r)

Etienne

On Sun, Mar 13, 2011 at 6:27 PM, Komine <momadou@yahoo.fr> wrote:

> Dear all,
> I tried your suggestion doing this:
>
> library(raster)
> myobject <-
>
> raster("C:\\Users\\komine\\Desktop\\MODIS\\MYD09GQ.A2010280.h16v07.005.2010282160347.sur_refl_b01_1.tif")
> e <- extent(-90, -32, -60, 15)
> r <-
>
> crop("C:\\Users\\komine\\Desktop\\MODIS\\MYD09GQ.A2010280.h16v07.005.2010282160347.sur_refl_b01_1.tif",e)
> plot(myobject)
>
> the result is here:
> > library(raster)
> > myobject <-
> >
> raster("C:\\Users\\komine\\Desktop\\MODIS\\MYD09GQ.A2010280.h16v07.005.2010282160347.sur_refl_b01_1.tif")
> Fixing "AREA_OR_POINT=Point" georeference
> > e <- extent(-90, -32, -60, 15)
> > r <-
> >
> crop("C:\\Users\\komine\\Desktop\\MODIS\\MYD09GQ.A2010280.h16v07.005.2010282160347.sur_refl_b01_1.tif",e)
> Erreur dans function (classes, fdef, mtable)  :
>  unable to find an inherited method for function "crop", for signature
> "character"
> > plot(myobject)
>
> However the raster appear in spite of the previous error message.
> 1- I suppose that I did an error although R read my raster?
> 2- Could you explain me the meaning of: extent(-90, -32, -60, 15)
>
> Thanks for your help
>
>
> --
> View this message in context:
> http://r-sig-geo.2731867.n2.nabble.com/Open-raster-extract-pixel-value-tp6166730p6167299.html
> Sent from the R-sig-geo mailing list archive at Nabble.com.
>
> _______________________________________________
> R-sig-Geo mailing list
> R-sig-Geo@r-project.org
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>

	[[alternative HTML version deleted]]

