The user-level constructor: give a vertex table and a segment table
(as returned by pool_vertices() and pool_segments()) and get a
wkpool back. It is a thin wrapper around new_wkpool(), which checks
that every segment endpoint is a vertex id present in the pool.
Arguments
- vertices
A data.frame with columns
.vx(integer vertex ids),x,y, and optionallyz.- segments
A data.frame with integer columns
.vx0and.vx1(vertex ids), and optionally.featureand.path.- paths
Optional data.frame describing the paths: columns
.path,.feature,.part,.ring(as captured fromwk::wk_coords()identifiers byestablish_topology()).- crs
A CRS object (commonly an authority string such as "EPSG:4326"), carried but never interpreted, per wk's CRS propagation model. Use
NULLfor none, orwk::wk_crs_inherit().- geodesic
TRUEif segments should be interpreted as geodesics when coordinates are spherical,FALSEotherwise,NAto inherit.
See also
new_wkpool() for the low-level constructor,
establish_topology() to build a pool from wk geometry.
Examples
v <- data.frame(.vx = 1:4, x = c(0, 1, 1, 0), y = c(0, 0, 1, 1))
s <- data.frame(.vx0 = 1:4, .vx1 = c(2:4, 1L), .feature = 1L)
pool <- wkpool(v, s)
pool
#> <wkpool[4 segments, 4 vertices]>
#> [1] <segment: 1->2> <segment: 2->3> <segment: 3->4> <segment: 4->1>
# round trip through the accessors
wkpool(pool_vertices(pool), pool_segments(pool))
#> <wkpool[4 segments, 4 vertices]>
#> [1] <segment: 1->2> <segment: 2->3> <segment: 3->4> <segment: 4->1>