Created
May 18, 2020 12:18
-
-
Save cbrown5/65ac150cb71de8cc6c7923313a2b72f5 to your computer and use it in GitHub Desktop.
Convert stars raster to raster::raster
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Takes as an input a stars raster layer | |
#CJ Brown 2020-05-18 | |
st_as_raster <- function(rstars){ | |
rext <- st_bbox(rstars) | |
raster(t(rstars[[1]]), xmn = rext[1], xmx = rext[3], | |
ymn = rext[2], ymx=rext[4], | |
crs = st_crs(rstars)$proj4string) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment