points_to_mesh: Convert sfc_POINTS to a mesh of polygons (delaunay...

View source: R/geometry.R

points_to_meshR Documentation

Convert sfc_POINTS to a mesh of polygons (delaunay triangulation)

Description

Convert sfc_POINTS to a mesh of polygons (delaunay triangulation)

Usage

points_to_mesh(
  x,
  method = c("geometry", "sf")[1],
  varname = NULL,
  fun = mean,
  ...
)

Arguments

x

sf object with geometry of type POINT

method

charcater, 'geometry' (default) or 'sf'

varname

character one or more variable names to transfer to the polygon Ignored if method is not 'geometry'

fun

function to compute value the variables specifed by varname Ignored if method is not 'geometry'

...

other arguments for fun

Value

sf POLYGON table is method is 'geometry' and sf GEOMETRYCOLLECTION otherwise

See Also

delaunayn

stackoverflow

Examples

## Not run: 
pts <- sf::read_sf(system.file("datasets/penbay-points.gpkg", package = 'twinkle'))
mesh <- points_to_mesh(pts)
sst <- stars::read_stars(system.file("datasets/20140601-20140630-sst.tif", package = "twinkle"))
plot(sst[,,,1],
     main = "sst 2014-01-01",
     reset = FALSE,
     add.geom = list(sf::st_geometry(pts), col = 'orange', pch = 19))
plot(sf::st_geometry(mesh), add = TRUE, border = 'green')

## End(Not run)

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