change
See docs/reference/README.md for the MUST/SHOULD/MAY convention, and
docs/reference/shared.md for rules change shares with other tools.
Inputs¶
changeMUST accept exactly one old-version file and one new-version file per call.changeMUST load and coverage-clean both layers via the sharedcore.io.read_reproject_and_clean()helper before comparison.
Overlap computation¶
changeMUST computeshared_area,coverage_a,coverage_b, andioufor every old/new fid pair whose parts touch, using exactST_Intersection; it MUST NOT fall back to point-sampling on failure (seedocs/explanation/change.md).- Both layers MUST be exploded into parts before the join, so a multi-part fid does not collapse to one bbox spanning all its parts.
- An intersection crumb below
INTERSECTION_SLIVER_DEG2(raw, untransformed degree² area) MUST be dropped before area/ratio computation. - Area and ratio computation (
shared_area,coverage_a,coverage_b,iou) MUST use an equal-area projection (EQUAL_AREA_CRS), not raw EPSG:4326 degrees.
Classification¶
changeMUST classify every unit into exactly one of:unchanged,renamed,modified,relocated,split,merge,complex,created,removed.- Classification MUST be driven by connected-component cardinality
(
na/nb= old/new member count of a unioned cluster):1:0isremoved,0:1iscreated,1:manyissplit,many:1ismerge,many:manyiscomplex. - A
1:1cluster reached only through identity linking (no spatialtau_matchpass) MUST classify asrelocated. - A
1:1cluster that passed spatialtau_matchMUST classify asunchangedwhen its IoU is at or abovetau_sameand no linked code/name differs,renamedwhen its IoU is at or abovetau_sameand a linked code/name differs, andmodifiedwhen its IoU is belowtau_same. renamedMUST NOT fire whenlink_by_code/link_by_nameare both unset: pure geometry mode MUST NOT consult code/name for classification, only for display.- A pair MUST be linked by code/name only when
--link-by-code/--link-by-nameis set, the value is non-null on both sides, and the value is unique on that side (a value repeated within one side MUST NOT be used as an identity match). - An identity-matched pair MUST NOT be unioned ahead of spatial matching
unless every other
tau_match-passing spatial neighbor of both its fids is also identity-covered; a pair failing this guard MUST fall through to spatial-only classification instead (seedocs/explanation/change.md). link_modeMUST beeither(code OR name match links, default) orboth(code AND name must both match); any other value MUST raiseValueError.link_modeonly has an effect when bothlink_by_codeandlink_by_nameare set.
Column auto-detection¶
- A code/name column MUST be auto-detected only when the corresponding
--link-by-code/--link-by-nameflag is set and no explicit--code-column-*/--name-column-*was given for that side; an explicit column argument MUST always override auto-detection. - If linking is requested for a side and no column was given or
auto-detected on that side,
changeMUST raiseValueErrorrather than silently falling back to geometry-only comparison.
Outputs¶
changeperforms no topology hard gate at all; it is a read-only comparison between two inputs, not a fix.changeMUST always write two artifacts: a tabular changelog (no geometry column) and a spatial overlay layer, even when--link-by-code/--link-by-nameare unset.- The tabular changelog MUST contain one row per matched pair plus one
row per unmatched singleton (a pure
created/removedunit, or asplit/mergeremnant with nothing on the other side). - Every changelog row MUST echo the run's own
tau_match,tau_same,link_by_code,link_by_name, andlink_modevalues, regardless of that row's own classification. code_a/code_b/name_a/name_bMUST be null on every row unless the corresponding column was resolved (explicitly or via auto-detection) for that side.- The spatial overlay layer MUST contain every new-version unit tagged
with its
relationship_class, plus every old-version unit classedremoved; together these MUST tile the comparison area exactly once.
Configuration (api.change.change() / CLI)¶
changeMUST process exactly one old file + one new file per call.output_pathMUST default to{old_stem}_{new_stem}_changelog.csvnext to the old file; its suffix MUST be a tabular format (.csvor.parquet), any other suffix MUST raiseValueError.overlay_pathMUST default tooutput_path's stem with an_overlaysuffix, in the old file's own format; its suffix MUST be a GDAL-vector-supported format, any other suffix MUST raiseValueError.changeMUST raiseFileExistsErrorif either output path already exists and overwriting wasn't requested.tau_matchandtau_sameMUST be floats in[0, 1]; there is noauto/allstring mode.step, if given, MUST be one ofinputs,overlap,classify,outputs; any other value MUST raiseValueError.