Re: [R-sig-Geo] Clip a raster

2010-10-18 Thread Mayeul KAUFFMANN
123. TP: 483) -Original Message- From: r-sig-geo-boun...@stat.math.ethz.ch [mailto:r-sig-geo-boun...@stat.math.ethz.ch] On Behalf Of Johannes Signer Sent: Thursday, October 14, 2010 5:39 PM To: Manuel Spínola Cc: r-sig-geo@stat.math.ethz.ch Subject: Re: [R-sig-Geo] Clip a raster Hi

Re: [R-sig-Geo] Clip a raster

2010-10-15 Thread Paulo Brando
Dear All, I have been using the crop function in the raster package, but haven't figured out yet how this function deals with pixels that falls on the edge of a polygon. Thanks, Paulo On Thu, Oct 14, 2010 at 12:42 PM, Manuel Spínola mspinol...@gmail.comwrote: Thank you very much Robert.

Re: [R-sig-Geo] Clip a raster

2010-10-15 Thread Robert J. Hijmans
Paulo, If the polygon does not cover half the edge-pixel, it is ignored. That should probably change so that all cells that are touched are included. To be safe you could use a slightly larger extent, as in: e - intersectExtent(x, extent(y)) + 2 * xres(x) crop(x, e) Robert On Fri, Oct 15,

[R-sig-Geo] Clip a raster

2010-10-14 Thread Manuel Spínola
Dear list members, I download bioclim data in a raster format (estension: .bil) and I would like to clip the variables to a ploygon stored as a shapefile (Costa Rica outline). How can I do that? I read the raster file like this: x - readGDAL(bio1_23.bil) Thank you very much in advance.

Re: [R-sig-Geo] Clip a raster

2010-10-14 Thread Johannes Signer
Hi, with the raster package you could use: polygons to raster (?polygonsToRaster), converting the Costa Rica shapefile to a raster and then use mask (?mask). Best Johannes On Thu, Oct 14, 2010 at 5:16 PM, Manuel Spínola mspinol...@gmail.com wrote:  Dear list members, I download bioclim data

Re: [R-sig-Geo] Clip a raster

2010-10-14 Thread Robert J. Hijmans
Manuel, if costarica is a SpatialPolygons* object, you can do: r - raster(bio1_23.bil) cr - crop(r, costarica) Robert On Thu, Oct 14, 2010 at 8:16 AM, Manuel Spínola mspinol...@gmail.com wrote:  Dear list members, I download bioclim data in a raster format (estension: .bil) and I would

Re: [R-sig-Geo] Clip a raster

2010-10-14 Thread Manuel Spínola
Thank you Roman and Johannes, What I am doing wrong? x - readGDAL(bio1_23.bil) xr = raster(x) map - readOGR(dsn=C:/ProyectoRespacial/EvalHab_reporte, layer=Cr_wgs84_meso) # shapefile r2 - polygonsToRaster(map, xr) Found 1 region(s) and 1 polygon(s) Error: no se puede ubicar un vector de

Re: [R-sig-Geo] Clip a raster

2010-10-14 Thread Manuel Spínola
Thank you very much Robert. That's works perfect. Manuel On 14/10/2010 10:21 a.m., Robert J. Hijmans wrote: Manuel, if costarica is a SpatialPolygons* object, you can do: r- raster(bio1_23.bil) cr- crop(r, costarica) Robert On Thu, Oct 14, 2010 at 8:16 AM, Manuel

Re: [R-sig-Geo] Clip a raster

2009-02-05 Thread Robert Hijmans
Etienne, I added a function clickBbox to the raster package for increased interactivity #install.packages(raster, repos=http://R-Forge.R-project.org;) require(raster) # read a raster file from disk filename - system.file(pictures/Rlogo.jpg, package=rgdal) r - rasterFromFile(filename, TRUE)

Re: [R-sig-Geo] Clip a raster

2009-02-04 Thread Roger Bivand
On Tue, 3 Feb 2009, Etienne Bellemare Racine wrote: Is it possible to clip a raster after having it read with readGDAL ? Instead of using region.dim() and offset(), I would like to clip it on the fly to visualize statistics associated with objects of different size. The clip is square

[R-sig-Geo] Clip a raster

2009-02-03 Thread Etienne Bellemare Racine
Is it possible to clip a raster after having it read with readGDAL ? Instead of using region.dim() and offset(), I would like to clip it on the fly to visualize statistics associated with objects of different size. The clip is square -specified with upper left and lower right corners- and fit