Skip to contents

Establish topology from any wk-handleable geometry

Usage

establish_topology(x, ...)

Arguments

x

Any geometry wk can handle (sf, sfc, wkb, wkt, geos, s2, xy, ...)

...

reserved for future use

Value

A wkpool object (segments with vertex pool)

Details

Vertices are minted as-is from the input coordinates. No snapping or deduplication is performed - the pool represents the exact truth of the input geometry. Use merge_coincident() afterwards to discover/establish shared topology.

Segments track their feature origin via .feature attribute, enabling discovery of shared boundaries and neighbour relations.

Segments also carry a minted .path id - one id per input ring or linestring - with a sidecar table (see pool_paths()) recording each path's feature, part and ring identity as captured from wk::wk_coords(). This provenance makes cycles, ring roles and feature structure recoverable exactly, in input order and input winding: see find_cycles(), classify_cycles() and cycles_to_wkt().

The coordinate reference system of the input (as reported by wk::wk_crs()) and its geodesic flag (wk::wk_is_geodesic()) are captured on the pool and travel with it through subsetting, merging and compaction, and back out through the round-trip functions.

Examples

x <- wk::as_wkb(c(
  paste0(
    "MULTIPOLYGON (((0 0, 0 1, 0.75 1, 1 0.8, 0.5 0.7, ",
    "0.8 0.6, 0.69 0, 0 0), (0.2 0.2, 0.5 0.2, ",
    "0.5 0.4, 0.3 0.6, 0.2 0.4, 0.2 0.2)))"),
  "MULTIPOLYGON (((0.69 0, 0.8 0.6, 1.1 0.63, 1.23 0.3, 0.69 0)))"
))

pool <- establish_topology(x)