[R-sig-Geo] raster::crop

Agustin Lobo alobolistas at gmail.com
Tue Nov 30 08:48:04 CET 2010


Thanks,

and summarizing messages exchanged with Robert,

subs = bN3[1000:1100,1000:1100, drop=FALSE]

is the easiest, while

e<- extent(c (xFromCol(bN3, 1000), xFromCol(bN3, 1100), yFromRow(bN3,
1100), yFromRow(bN3, 1000)))
x<- crop(bN3, e)

is the fastest. And Robert plans a simplifies syntax for using extent
with row, cols in the future, i.e. like:
extent(x, 1000,1100,1000,1100)

Agus

2010/11/29 steven mosher <moshersteven at gmail.com>:
>  you should be able to use xFromCol, yFromCol  etc  to get the coordinate
> for
> the extent you want to crop. or xyFromCell.
>
>
>
>
>
> On Sun, Nov 28, 2010 at 9:47 AM, Agustin Lobo <alobolistas at gmail.com> wrote:
>
>> Is it possible to crop a raster by selecting rows and cols? i.e. the
>> equivalent to
>>
>> subs = bN3[1000:1100,1000:1100]
>>
>> but subs should remain a raster (or a brick)
>> (crop seems to require geographic coordinates even if the raster is
>> projected)
>>
>> Thanks
>>
>> Agus
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> R-sig-Geo at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
>
>        [[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
>



More information about the R-sig-Geo mailing list