lsat_get_pixels_in_buffer: Landsat 8 pixel centers within a buffer around point...

View source: R/lsat_get_pixels_in_buffer.R

lsat_get_pixels_in_bufferR Documentation

Landsat 8 pixel centers within a buffer around point coordinates This function is currently in development and not intended for use!!! Helper function that uses lsat_get_pixel_centers() to determine all Landsat 8 pixel centre coordinates within a buffer around a set of point coordinates.

Description

Landsat 8 pixel centers within a buffer around point coordinates This function is currently in development and not intended for use!!! Helper function that uses lsat_get_pixel_centers() to determine all Landsat 8 pixel centre coordinates within a buffer around a set of point coordinates.

Usage

lsat_get_pixels_in_buffer(
  point_coord_sf,
  buffer_dist = 0,
  sample_id_from = "sample_id",
  n_threads = 1
)

Arguments

point_coord_sf

simple feature collection of points with a column that indicates the sample_id (speciefied with option sample_id_from).

buffer_dist

buffer distance to be applied to point coordinates. Note: a distance of 15 m is automatically added. So when buffer distance = 0 the nearest pixel centre to the coordinate(s) is identified. If buffer distance = 30, then the centre coordiantes of the pixels in the 3 x 3 neigbourhood that is centred on the coordinate(s) os returned.

sample_id_from

column that provides the unique sample identifier. Defaults to "sample_id". Pixels centers within the buffer are returned by appending a counter "_x" to this column.

n_threads

the number of threads to be used if parallel processing is desired. Recommended for large datasets.

Value

Simple feature collection of points that denote pixel centres within buffer around input coordinates. Unique identifiers are provided by appending a numerical counter "_x" to original identifiers in column specified in the sample_id argument.

Author(s)

Jakob J. Assmann

Examples


# Using sf, dplyr and rgee
library(sf)
library(dplyr)
library(rgee)

# Initialize rgee
ee_Initialize()

# Generate test points
test_points_sf <- st_sfc(st_point(c(-149.6026, 68.62574)),
                         st_point(c(-149.6003, 68.62524)),
                         st_point(c(-75.78057, 78.87038)),
                         st_point(c(-75.77098, 78.87256)),
                         st_point(c(-20.56182, 74.47670)),
                         st_point(c(-20.55376, 74.47749)), crs = 4326) %>%
  st_sf() %>%
  mutate(sample_id = c("toolik_1",
                      "toolik_2",
                      "ellesmere_1",
                      "ellesmere_1",
                      "zackenberg_1",
                      "zackenberg_2"),
         region = c("toolik", "toolik",
                    "ellesmere", "ellesmere",
                    "zackenberg", "zackenberg"))

# Retrieve pixel centres in 3 x 3 neighbourhood using parallel processing
# and 4 threads


logan-berner/lsatTS documentation built on Oct. 21, 2024, 12:23 a.m.