Learn R Programming

sf (version 0.2-2)

geos: Geometric operations on (pairs of) simple feature geometries

Description

Geometric operations on (pairs of) simple feature geometries

Usage

st_is_valid(x)
st_is_simple(x)
st_distance(x, y = x)
st_relate(x, y)
st_intersects(x, y, sparse = TRUE)
st_disjoint(x, y, sparse = TRUE)
st_touches(x, y, sparse = TRUE)
st_crosses(x, y, sparse = TRUE)
st_within(x, y, sparse = TRUE)
st_contains(x, y, sparse = TRUE)
st_overlaps(x, y, sparse = TRUE)
st_equals(x, y, sparse = TRUE)
st_covers(x, y, sparse = TRUE)
st_covered_by(x, y, sparse = TRUE)
st_equals_exact(x, y, par, sparse = TRUE)
st_is_within_distance(x, y, par, sparse = TRUE)
st_buffer(x, dist, nQuadSegs = 30)
st_boundary(x)
st_convex_hull(x)
st_union_cascaded(x)
st_simplify(x, preserveTopology = FALSE, dTolerance = 0)
st_triangulate(x, dTolerance = 0, bOnlyEdges = FALSE)
st_polygonize(mlst)
st_centroid(x)
st_segmentize(x, dfMaxLength)
st_merge(x, union = FALSE)
st_intersection(x, y0)
st_union(x, y0)
st_difference(x, y0)
st_sym_difference(x, y0)

Arguments

x
first simple feature (sf) or simple feature geometry (sfc) collection
y
second simple feature (sf) or simple feature geometry (sfc) collection
sparse
logical; should a sparse matrix be returned (TRUE) or a dense matrix?
par
numeric; parameter used for "equals_exact" (margin) and "is_within_distance"
dist
buffer distance
nQuadSegs
integer; number of segments per quadrant (fourth of a circle)
preserveTopology
logical; carry out topology preserving simplification?
dTolerance
numeric; tolerance parameter
bOnlyEdges
logical; if TRUE, return lines, else return polygons
mlst
object of class MULTILINESTRING or geometry list-column containing these
dfMaxLength
numeric; max length of a line segment
union
logical; apply st_union_cascaded to the merged geometry set?
y0
object of class sfc which is merged, using c.sfg (st), before intersection etc. with it is computed

Value

matrix (sparse or dense); if dense: of type character for relate, numeric for distance, and logical for all others; matrix has dimension x by y; if sparse (only possible for those who return logical in case of dense): return list of length length(x) with indices of the TRUE values for matching y.st_is_simple and st_is_valid return a logical vectorst_distance returns a dense numeric matrix of dimension length(x) by length(y)st_relate returns a dense character matrixst_intersects ... st_is_within_distance return a sparse or dense logical matrix with rows and columns corresponding to the number of geometries (or rows) in x and y, respectivelyst_buffer ... st_segmentize return an sfc object with the same number of geometries as in x

Details

requires GEOS version 3.4 or above

Examples

Run this code
# nc = st_read(system.file("gpkg/nc.gpkg", package="sf"), "nc.gpkg", crs = 4267)
nc = st_read(system.file("shape/nc.shp", package="sf"), "nc", crs = 4267)
plot(st_union_cascaded(st_sfc(do.call(c, st_geometry(nc)))),col=0)
mls = st_multilinestring(list(matrix(c(0,0,0,1,1,1,0,0),,2,byrow=TRUE)))
x = st_polygonize(mls)
plot(nc, axes = TRUE)
plot(st_centroid(nc), add = TRUE, pch = 3)
m = st_merge(nc)
plot(st_convex_hull(nc))
plot(nc, border = grey(.5))

Run the code above in your browser using DataLab