Skip to content
Prev 8947 / 29559 Next

clip a SpatialPolygonsDataFrame

On Fri, 6 Aug 2010, Laetitia Blanc wrote:

            
No, this is a misunderstanding. Until you get this right, please forget 
the simulation, make sure everything is correct for a single period 
first. I am pretty sure that lynxkde$dens is a matrix, and if you 
take the trouble to read help(image), you'll see that if the first 
argument is a matrix, then the window is set to 0,1. You need to pass the 
cell centres of the xgrids and ygrids to the image call. Beware that if 
the spd3$x and spd3$y change by i, the grid will be different each time, 
evenj though it is 20x20, it will start somewhere else, and have a 
different cell dimension.

I think that you are using a function from the stam package - you need to 
adapt it to pass the x.seq and y.seq values now generated internally in as 
arguments, which will permit you to make sure that you have full control 
of the location of the output grids. If you then pass the same x.seq and 
y.seq to image() as the first two arguments, and the matrix as the third 
argument, it will use them to specify its axes, giving you the correct 
window. You need to be sure that your x.seq and y.seq contain all of the 
xlong and xlat for all periods. If stkde took a GridTopology object as a 
grid definition, the output could easily be used to create a 
SpatialGridDataFrame object, which would be very easy to plot in register 
with your boundaries, but this is something for the package maintainer.

Hope this helps,

Roger

PS. CC-ing the stam maintainer.