I'm getting frustrated at what I thought would be simple raster manipulations...

* How can I shift a SpatialGridDataFrame? I can't just change the coordinates:

> coordinates(compare)=coordinates(compare)+10
Error in `coordinates<-`(`*tmp*`, value = c(10.5, 11.5, 12.5, 13.5, 14.5, : setting coordinates cannot be done on Spatial objects, where they have already been set

Do I have to construct a new GridTopology object, then feed that to SpatialGridDataFrame along with the @data slot from the original? It seems to work, but I was hoping for something simpler, and I always get the jitters when working with slots since I tend to think of them as private object data that I shouldn't mess with. Isn't there a 'getData' method?

 * How can I construct larger SpatialGridDataFrames by tiling smaller ones?

If they operated like matrices or data frames I could just cbind or rbind them together. I think I'm going to have to do a similar procedure as above - work out the new GridTopology and pass a new data frame constructed from merging the individual data frames together and making sure it's all in the right order. Which is tricky, because the SpatialGridDataFrame constructor expects its data argument to start at top-left and sweep across and then down. To paste another raster to the right of an existing one would mean mingling the data frame rows....

Or am I just missing something simple with this? Of course it *will* be simple, once I've written the tiling functions:

 foo = tile(bar,west=baz)

will construct a new grid 'foo' which is bar with baz pasted on it's western edge, equivalent to:

 foo = tile(baz,east=bar)

it'll check the grids have the same number of rows (or for N-S tiling, columns) and that the data frames are similar.

Barry

_______________________________________________
R-sig-Geo mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo

Reply via email to