st_xy2sfc | R Documentation |
replace x y raster dimensions with simple feature geometry list (points, or polygons = rasterize) and vice versa
st_xy2sfc(x, as_points, ..., na.rm = TRUE)
st_sfc2xy(x, ...)
x |
object of class |
as_points |
logical; if |
... |
for 'st_xy2sfc': arguments passed on to |
na.rm |
logical; omit (remove) cells which are entirely missing valued (across other dimensions)? |
'st_xy2sfc' replaces x y raster dimensions with simple feature geometry list (points, or polygons = rasterize)
'st_sfc2xy' replaces POINT simple feature geometry list with an x y raster
'st_xy2sfc' returns an object of class stars
with x and y raster dimensions replaced by a single sfc geometry list column containing either points, or polygons. Adjacent cells with identical values are not merged; see st_rasterize
for this.
'st_sfc2xy' returns an object of class stars
with a POINT list replaced by X and Y raster dimensions. This only works when the points are distributed over a regular or rectilinear grid.
(reduced_nc = read_ncdf(system.file("nc/reduced.nc", package = "stars")))
(x = stars::st_xy2sfc(reduced_nc, as_points = TRUE, na.rm = FALSE))
# roundtrip:
st_sfc2xy(x, dims=c("X", "Y","zlev","time"))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.