Aliases: st_warp
Keywords:
### ** Examples geomatrix = system.file("tif/geomatrix.tif", package = "stars") (x = read_stars(geomatrix))
stars object with 2 dimensions and 1 attribute attribute(s): Min. 1st Qu. Median Mean 3rd Qu. Max. geomatrix.tif 74 107 123 126.765 132 255 dimension(s): from to offset delta refsys point x/y x 1 20 1841002 1.5 WGS 84 / UTM zone 11N TRUE [x] y 1 20 1144003 -1.5 WGS 84 / UTM zone 11N TRUE [y] sheared raster with parameters: -5 -5
new_crs = st_crs('OGC:CRS84') y = st_warp(x, crs = new_crs) plot(st_transform(st_as_sfc(st_bbox(x)), new_crs), col = NA, border = 'red') plot(st_as_sfc(y, as_points=FALSE), col = NA, border = 'green', axes = TRUE, add = TRUE) image(y, add = TRUE, nbreaks = 6) plot(st_as_sfc(y, as_points=TRUE), pch=3, cex=.5, col = 'blue', add = TRUE) plot(st_transform(st_as_sfc(x, as_points=FALSE), new_crs), add = TRUE)
# warp 0-360 raster to -180-180 raster: r = read_stars(system.file("nc/reduced.nc", package = "stars"))
sst, anom, err, ice,
r %>% st_set_crs('OGC:CRS84') %>% st_warp(st_as_stars(st_bbox(), dx = 2)) -> s plot(r, axes = TRUE) # no CRS set, so no degree symbols in labels
plot(s, axes = TRUE)
# downsample raster (90 to 270 m) r = read_stars(system.file("tif/olinda_dem_utm25s.tif", package = "stars")) r270 = st_as_stars(st_bbox(r), dx = 270) r270 = st_warp(r, r270)