R/transform.R
st_transform.Rd
transform geometries in stars objects to a new coordinate reference system, without warping
# S3 method for stars st_transform(x, crs, ...) # S3 method for stars st_transform_proj(x, crs, ...)
x | object of class |
---|---|
crs | object of class |
... | ignored |
For simple feature dimensions, st_transform is called, leading to lossless transformation. For gridded spatial data, a curvilinear grid with transformed grid cell (centers) is returned, which is also lossless. To convert this to a regular grid in the new CRS
, use st_warp (which is in general lossy).
#> stars object with 2 dimensions and 1 attribute #> attribute(s): #> geomatrix.tif #> Min. : 74.0 #> 1st Qu.:107.0 #> Median :123.0 #> Mean :126.8 #> 3rd Qu.:132.0 #> Max. :255.0 #> dimension(s): #> from to offset delta refsys point values x/y #> x 1 20 1841002 1.5 WGS 84 / UTM zone 11N TRUE NULL [x] #> y 1 20 1144003 -1.5 WGS 84 / UTM zone 11N TRUE NULL [y] #> sheared raster with parameters: -5 -5new = st_crs(4326) y = st_transform(x, new) plot(st_transform(st_as_sfc(st_bbox(x)), new), col = NA, border = 'red')