if (requireNamespace("terra", quietly = TRUE) && terra_is_working()) {
# Load a test Sentinel-2 band
s2_file <- system.file(
"demo-geotiff/S2_20LMR_B04_20220630.tif",
package = "snic"
)
s2_rast <- terra::rast(s2_file)
# Create some test coordinates in pixel space
seeds_rc <- data.frame(r = c(10, 20, 30), c = c(15, 25, 35))
# Convert to map coordinates (x,y)
seeds_xy <- as_seeds_xy(seeds_rc, s2_rast)
# Convert to geographic coordinates (lat,lon)
seeds_wgs84 <- as_seeds_wgs84(seeds_rc, s2_rast)
}
Run the code above in your browser using DataLab