topologyprocessor – BRDR - Aligning borders

# TopologyProcessor

    processor.TopologyProcessor(config, feedback=None)

Processor that aligns geometries while preserving topological relationships.

Instead of processing features independently, the TopologyProcessor decomposes thematic data into unique ‘arcs’ (shared boundaries). Each arc is aligned once using network-based processing, ensuring that shared boundaries remain perfectly snapped together in the final output.

## Attributes

Name | Type | Description
--- | --- | ---
processor_id | ProcessorID | The unique identifier for this processor (ProcessorID.TOPOLOGY).
thematic_data | (AlignerFeatureCollection, optional) | Cached reference to the full thematic dataset used for topology building.
topo_thematic | (dict, optional) | The generated TopoJSON-like structure of the thematic data.
thematic_geometries_to_process | (dict, optional) | Mapping of arc IDs to their respective LineString geometries.
id_to_arcs | (dict, optional) | Mapping of feature IDs to the list of arc IDs that form their boundary.
wkb_to_id | (dict, optional) | Reverse index mapping geometry WKB strings to feature IDs.

## Methods

Name | Description
--- | ---
process | Aligns a geometry by processing its topological arcs.

### process

    processor.TopologyProcessor.process(
        input_geometry,
        reference_data,
        mitre_limit,
        correction_distance,
        relevant_distance,
        thematic_data,
        **kwargs,
    )

Aligns a geometry by processing its topological arcs.

This method identifies which unique arcs belong to the input geometry, aligns those arcs using the `NetworkGeometryProcessor`, and then reconstructs the final geometry.

#### Parameters

Name | Type | Description | Default
--- | --- | --- | ---
input_geometry | BaseGeometry | The specific thematic geometry to align. | required
reference_data | AlignerFeatureCollection | The reference dataset used for alignment. | required
mitre_limit | float | Mitre limit for buffering operations. | required
correction_distance | float | Distance used for cleaning and noise reduction. | required
relevant_distance | float | The maximum distance for alignment. | required
thematic_data | AlignerFeatureCollection | The full thematic collection required to build/query the topology. | required
**kwargs | Any | Additional arguments. | `{}`

#### Returns

Name | Type | Description
--- | --- | ---
| ProcessResult | The reconstructed geometry where shared boundaries are consistently aligned.

#### Notes

The topological workflow ensures “gapless” alignment:

    graph TD
        In[Input Geometry] --> Cache{Cache Built?}
        Cache -- No --> Build[Build Topology: Extract Arcs]
        Build --> Cache
        Cache -- Yes --> Map[Map Geometry to Arc IDs]
        Map --> Loop[For each unique Arc]
        Loop --> Net[Align Arc via NetworkProcessor]
        Net --> Loop
        Loop --> Dissolve[Reconstruct Polygon from Aligned Arcs]
        Dissolve --> End[Final ProcessResult]