Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- library(raster)
- library(spatstat)
- # First set the geographic extent we'll be using
- e <- extent(-20, 60, -40, 35)
- # Then read in the Maximum Green Vegetation Fraction tiff and crop it
- mgvf <- raster("MGVF_2001_30_arc_sec.tif")
- mgvf.2001.africa <- crop(mgvf, e)
- # Now let's create a window for in spatstat
- SP.win <- as(e, "SpatialPolygons")
- W <- as(SP.win, "owin")
- # Finally, we create the .im object
- mgvf.img <- as.im(X = "mgvf.2001.africa", W = W)
- # Notice, there are no errors thrown. However, compare the plots below and see the loss of information:
- plot(mgvf.2001.africa)
- plot(mgvf.img)
- library(geostatsp)
- mgvf.img <- as.im(mgvf.2001.africa)
- rotate = function(mat) t(mat[nrow(mat):1,,drop=FALSE]) # mat - matrix
Add Comment
Please, Sign In to add comment