I have a spatial grid of an image. Now I want to use this grid and make a finer resolution grid out of it.
For example an image structure in R is given below:
str(c)
Formal class 'SpatialGridDataFrame' [package "sp"] with 4 slots
..@ data :'data.frame': 35100 obs. of 1 variable:
.. ..$ class: num [1:35100(1d)] 0 0 0 0 0 0 0 0 0 0 ...
..@ grid :Formal class 'GridTopology' [package "sp"] with 3 slots
.. .. ..@ cellcentre.offset: Named num [1:2] 563450 6355500
.. .. .. ..- attr(*, "names")= chr [1:2] "x" "y"
.. .. ..@ cellsize : num [1:2] 25 25
.. .. ..@ cells.dim : int [1:2] 36 39
..@ bbox : num [1:2, 1:2] 563438 6355488 564338 6356463
.. ..- attr(*, "dimnames")=List of 2
.. .. ..$ : chr [1:2] "x" "y"
.. .. ..$ : chr [1:2] "min" "max"
..@ proj4string:Formal class 'CRS' [package "sp"] with 1 slot
.. .. ..@ projargs: chr "+proj=utm +zone=35 +south +ellps=WGS84 +towgs84=0,0,0,0,0,0,0 +units=m +no_defs"
Here i want to create a finer resolution grid with increasing the cell.dim i.e by multiplying rows and columns by a scale factor S=5 and also changing cell size by dividing the same by scale factor 5.
So, to do this we need to change the cellcentre.offset, which am unable to do so. The bounding box would remain same.
The problem m facing is that the data is of 35100 observations but when i display it, i can only display 1404 observations (36*39) because of the present grid topology. I want to display all the observations for that I need a finer resolution grid topology with the same bounding box.
Best Answer
I got the solution.
For creating a new grid we first need the bounding box and the pixel size to which it is to be changed.
The below code would form a new grid of any resolution: