[R-sig-Geo] Creating a raster and setting extent in R
Safeeq Khan
safeeqkhan at gmail.com
Thu Feb 9 05:27:36 CET 2017
I am trying to create a raster with 922 columns and 444 rows at
0.06250-degree spatial resolution. However, after I set the following
extent the resolution of the resulting raster comes out to be 0.06243221.
It seems like the extent function is only reading the first 4 digits after
the decimal for both xmn and xmx.
Here is a sample code I am trying:
r <- raster(ncol=922, nrow=444)
bb <- extent(235.40625,292.96875,25.15625, 52.84375)
extent(r) <- bb
r <- setExtent(r, bb)
I have also tried to only set the extent and resolution but then I only get
921 columns and 443 rows.
r <- raster() bb <- extent(235.40625,292.96875,25.15625, 52.84375)
extent(r) <- bb res(r) <-0.06250 r <- setExtent(r, bb)
Any thought?
Best,
Safeeq
[[alternative HTML version deleted]]
More information about the R-sig-Geo
mailing list