[R-sig-Geo] "Argument is of length 0" when extract values from a raster

Xin LIN linxin at craes.org.cn
Fri Mar 11 12:48:19 CET 2011


Hi everyone,

I am trying to extract values from a raster with various irregular polygons
(say, boundaries of cities). I used the "extract" function in the "raster"
package with the argument weights=T to account for the percentage of each
cell covered by the polygon. It is interesting to find that this function
does not always work. It seems that when the polygon is small and covers only
one or two cells, it stop working with "m(xy)[2] != 2) { : argument is of
length zero". I cannot figure out why. Could you please give me some advice?
I will appreciate any help from you and thanks so much in advance.

P.S. I use the latest version of "raster" package.

Xin



More information about the R-sig-Geo mailing list