edge-clip
See docs/reference/README.md for the MUST/SHOULD/MAY convention, and
docs/reference/shared.md for rules edge-clip shares with other tools.
Inputs¶
edge-clipMUST load the children layer and the parent/clip layer raw, neither coverage-checked nor -cleaned.edge-clipMUST NOT require or read aparent_fidcolumn on the children layer.edge-clipMUST accept exactly one children file and exactly one parent/clip file per call, a strict 1:1 primitive (seedocs/adr/0080); batching many children files against one shared parent load isedge-mosaic's job (seedocs/reference/edge_mosaic.md).- The output row MUST carry a
source_filecolumn recording the path of the children file it came from.
Assignment¶
edge-clipMUST internally assign every child to exactly one parent before clipping, viaassign-one's file-wide majority-vote strategy (seedocs/explanation/assign.md): every child is forced onto the one parent that wins a majority vote by count, unconditionally, not evaluated per child. A child with zero individual overlap with the winner is not dropped at this stage; it still gets clipped against the winner and MAY drop later if that clip result is empty (see Clipping).- A whole children file with no overlap against any parent at all MUST be dropped, not clipped against the wrong parent.
Clipping¶
edge-clipMUST clip each row to its ownparent_fid's geometry viaST_Intersection, one distinctparent_fidat a time, each in its own spawned OS subprocess.- Within one
parent_fid's subprocess,edge-clipMUST grid-subdivide that parent's boundary into small tiles before intersecting once its vertex count exceeds an adaptive threshold, sizing the tile grid from that parent's own vertex density, and MUST join children to tiles via bbox comparison, neverST_Intersects. - A child whose clipped result is empty MUST be dropped from the output,
not treated as fatal, and MUST be recorded in the issues report as a
kind='clip-empty'row (see Outputs). edge-clipMUST raise immediately on the firstparent_fidwhose subprocess fails, aborting the whole run rather than skipping just thatparent_fid.
Outputs¶
edge-clipMUST NOT run the coverage hard gate indocs/reference/shared.mdon its own output: closing seams between clipped pieces isedge-stitch's job, notedge-clip's.edge-clipMUST raiseRuntimeErrorif the clipped result has zero rows.edge-clipMUST export the clipped layer to the output file.edge-clipMUST export an issues report alongside it, using the shared schema indocs/reference/shared.md, whenever it has at least onekind='clip-empty'row (or, when a code join is given, onecode-mismatch/code-fallbackrow); when it would be empty, no file MUST be written (and a stale file from a previous run at that path MUST be removed).
Configuration (api.edge_clip.clip() / CLI)¶
- The output path MUST default to the input path with a
_clippedsuffix. The issues-report path MUST default to the output path with an_issuessuffix. edge-clipMUST raiseFileExistsErrorif either output path already exists and overwriting wasn't requested.step, if given, MUST be one ofinputs,assign,edge-clip,outputs; any other value MUST raiseValueError.edge-clipMAY acceptmatch_column/parent_match_column/child_match_columnto override spatial assignment with an exact code join (seedocs/reference/shared.md,docs/explanation/assign.md), addingcode-mismatch/code-fallbackrows to the issues report alongside anyclip-emptyrows.edge-clipMAY acceptcarry_columns(CLI:--carry-column) to copy named parent columns onto every matched child (seedocs/reference/shared.md,docs/adr/0077).