When I specify eps=25 (m resolution) in a call to distmap... > library(spatstat) > temp <- data.frame(x=-670049.2, y=752814.6, X2=-669961.9, Y2=752648.2) > subwin<-owin(xrange=c(-100, 100) + sort(c(temp$x, temp$X2)), yrange=c(-100, 100) + sort(c(temp$y, temp$Y2))) > trajpsp<-psp(temp$x,temp$y, temp$X2, temp$Y2, subwin, check=TRUE) > plot(trajmap<-distmap(trajpsp, eps=25)) > trajmap$xstep [1] 23.94167 > trajmap$ystep [1] 24.42667
...The resulting resolution is slightly different than 25x25 metres. So now when I use it as a mask: > trajmap$v<-ifelse(trajmap$v>50, 0, 1) > library(maptools) ...and convert it to a RasterLayer for matrix algebra with another raster > trajrast<-raster(as.SpatialGridDataFrame.im(from=trajmap)) > tempmap<-crop(habmap, extent(trajrast)) # tempmap.grd is attached > top<-table(getValues(tempmap*trajrast)) Error in compare(c(e1, e2)) : Different bounding box Error in getValues(tempmap * trajrast) : error in evaluating the argument 'x' in selecting a method for function 'getValues' ...it doesn't work because the resolution is not exactly equal. Now I can sometimes trick it when the number of rows and cells are still equal, BUT... extent(trajrast)<-extent(tempmap) > top<-table(getValues(tempmap*trajrast)) Error in compare(c(e1, e2)) : nrows different Error in getValues(tempmap * trajrast) : error in evaluating the argument 'x' in selecting a method for function 'getValues' ...This is not always the case! How can I prevent the numbers of rows and columns from being so slightly different because of a minor different in resolution? Otherwise put, how can I make the actual resolution of my distmap image exactly 25m as desired? Tyler
tempmap.grd
Description: Binary data
_______________________________________________ R-sig-Geo mailing list R-sig-Geo@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-sig-geo