stars_pts_to_loc: Convert a sf POINTS object with a band variable into stars...

View source: R/stars.R

stars_pts_to_locR Documentation

Convert a sf POINTS object with a band variable into stars object to row, col, cell x, y, and band location coordinates (cell centers).

Description

Convert a sf POINTS object with a band variable into stars object to row, col, cell x, y, and band location coordinates (cell centers).

Usage

stars_pts_to_loc(
  pts = dplyr::select(stars_index_to_loc(form = "sf"), dplyr::all_of("band")),
  x = toy_multi(nb = 3, nc = 5, nr = 4, mask = FALSE),
  form = c("table", "sf")[1]
)

Arguments

pts

sf POINT object with one variable whose name matches the name of the band dimension in the x.

x

stars object. Limited to [x,y] of [x,y, band] dimensions

form

character, specifies output format as "table" (default) or "sf"

Value

a tibble of index, cell, col, row, x, y, and layer

  • index, 1-based 3d index into objects if as array

  • cell, 1-based 2d index into each band as if a matrix

  • col, 1-based column index

  • row, 1-based row index

  • x, coordinate of center of cell (not original input x value), missing if form is 'sf'

  • y, coordinate of center of cell (not original input y value), missing if form is 'sf'

  • band, 1-based integer index of band (note original band value)


BigelowLab/twinkle documentation built on Jan. 26, 2025, 6:34 a.m.