Skip to contents

Build a pool

Decompose any wk-handleable geometry into a shared vertex pool and segments that reference it, or assemble a pool from tables.

establish_topology()
Establish topology from any wk-handleable geometry
wkpool()
Create a wkpool from a vertex table and a segment table
new_wkpool()
Construct a wkpool from validated components
pool_combine()
Combine wkpool objects
vec_c(<wkpool>)
Combine many wkpool vectors into one vector
pool_compact()
Compact a pool by removing unreferenced vertices

Inspect and draw

Accessors for the vertices, segments and feature structure of a pool, CRS handling, wk handlers, and plotting.

pool_vertices() pool_segments() pool_feature() pool_path() pool_paths()
Access components of a wkpool object
wk_crs(<wkpool>) wk_set_crs(<wkpool>) wk_is_geodesic(<wkpool>) wk_set_geodesic(<wkpool>)
CRS and geodesic handling for wkpool
wk_handle(<wkpool>)
Handle wkpool objects with wk handlers
plot(<wkpool>)
Plot a wkpool object
plot(<wkpool_tri>)
Plot a triangle pool

Vertex identity

Coincident vertex detection and merging (with optional periodic x for the antimeridian), and topology diagnostics.

merge_coincident()
Merge coincident vertices in a pool
topology_report()
Report topology diagnostics
vertex_degree()
Calculate vertex degree (number of segments touching each vertex)

Shared edges and neighbours

Edges used by more than one feature, internal boundaries, and feature adjacency.

find_shared_edges()
Find shared edges between features
find_internal_boundaries()
Find internal boundaries (edges shared by exactly 2 features, opposite direction)
find_neighbours()
Build adjacency from shared edges

Arcs and nodes

Arc-node topology, maximal segment runs between nodes of degree other than two.

find_nodes()
Find nodes (vertices where degree != 2)
find_arcs()
Find arcs (maximal segment sequences between nodes)
as_arcs()
Convert arcs to a wkpool of arc segments
arc_node_summary()
Summarize arc-node structure

Cycles

Closed rings in the segment graph, classified by winding into outer rings and holes.

find_cycles()
Find closed cycles (rings) in segment graph
classify_cycles()
Classify cycles as outer rings or holes based on winding
cycle_signed_area()
Calculate signed area of a cycle
reverse_cycle()
Reverse a cycle's winding direction

Triangulation (experimental)

Triangle pools that share the vertex pool, and the inputs constrained triangulators need (holes, PSLG). This interface may change.

pool_triangulate()
Triangulate the polygons in a pool
new_wkpool_tri()
Construct a triangle pool
pool_triangles() tri_segments() wk_handle(<wkpool_tri>)
Access the triangles of a triangle pool
pool_holes() hole_points()
Get hole points for constrained triangulation
as_pslg()
Convert wkpool to a PSLG (planar straight line graph)

Export

Back to WKT or WKB, as segments, arcs or polygons from cycles.

segments_to_wkt() segments_to_wkb()
Convert wkpool segments to WKT
arcs_to_wkb() arcs_to_wkt()
Convert arcs to WKT linestrings
cycles_to_wkt() cycles_to_wkb()
Convert cycles to WKT polygons

Package

wkpool-package
wkpool: Vertex Pool Topology for Well-Known Geometry