Function to compute the Delaunay triangulation between points; only available for GEOS >= 3.4.0.

gDelaunayTriangulation(spgeom, tolerance=0.0, onlyEdges=FALSE)

## Arguments

spgeom

sp points object as defined in package sp

tolerance

Numerical tolerance value to be used in triangulation

onlyEdges

Logical, default returns triangles as polygons, if TRUE, returns a SpatialLines object with a single MULTILINESTRING

## Value

Either a SpatialPolygons object or a SpatialLines object containing a single Lines object of the undirected edges in the triangulation.

## Details

When onlyEdges is TRUE, the SpatialLines object may be de-merged to identify the input points that are touched by each edge, making it possible to identify spatial neighbours.

Roger Bivand

## References

https://en.wikipedia.org/wiki/Delaunay_triangulation

## Examples

if (version_GEOS0() > "3.4.0") {

data(meuse)
coordinates(meuse) <- c("x", "y")
plot(gDelaunayTriangulation(meuse))
points(meuse)
out <- gDelaunayTriangulation(meuse, onlyEdges=TRUE)
lns <- slot(slot(out, "lines")[[1]], "Lines")
out1 <- SpatialLines(lapply(seq(along=lns), function(i) Lines(list(lns[[i]]),
ID=as.character(i))))
out2 <- lapply(1:length(out1), function(i) which(gTouches(meuse, out1[i],
byid=TRUE)))
out3 <- do.call("rbind", out2)
o <- order(out3[,1], out3[,2])
out4 <- out3[o,]
out5 <- data.frame(from=out4[,1], to=out4[,2], weight=1)