AlignerGeometryProcessor

processor.AlignerGeometryProcessor(config, feedback=None)

Processor responsible for aligning thematic geometries to reference data.

This class identifies the geometry type and delegates the alignment logic to specialized processors (Dieussaert or Network-based) while handling validation and edge cases like area limits and zero-distance processing.

Attributes

Name Type Description
processor_id ProcessorID Unique identifier for the aligner processor.

Methods

Name Description
process Process and align a single geometry based on reference data.

process

processor.AlignerGeometryProcessor.process(
    correction_distance,
    reference_data,
    input_geometry,
    mitre_limit,
    relevant_distance=1.0,
    **kwargs,
)

Process and align a single geometry based on reference data.

The method validates the input geometry, checks against area constraints, and selects the appropriate sub-processor (Dieussaert for polygons or Network for linear/complex structures).

Parameters

Name Type Description Default
correction_distance float The maximum distance a vertex can be moved during alignment. required
reference_data GeoDataFrame or list[BaseGeometry] The target geometries to which the input_geometry should align. required
input_geometry BaseGeometry The geometry to be processed. Supports Polygon, MultiPolygon, and linear geometries. required
mitre_limit float The limit used for miter joins to prevent sharp spikes in corners. required
relevant_distance float The search radius used to find nearby reference geometries. If set to 0, no processing is performed. 1.0
**kwargs dict Additional keyword arguments passed to sub-processors. {}

Returns

Name Type Description
ProcessResult An object containing the aligned geometry and processing metadata (e.g., remarks or error logs).

Raises

Name Type Description
ValueError If the input_geometry is a GeometryCollection. If the input_geometry exceeds the configured area_limit.

Notes

The logic follows this decision flow:

graph TD
      A[Start Process] --> B{GeometryCollection?}
      B -- Yes --> C[Raise ValueError]
      B -- No --> D{Polygon/MultiPolygon?}
      D -- No --> E[Network Processor]
      D -- Yes --> F{Area > Limit?}
      F -- Yes --> G[Raise ValueError]
      F -- No --> H{RD == 0?}
      H -- Yes --> I[Return Original]
      H -- No --> J[Dieussaert Processor]
      J -- Success --> K[Return Result]
      J -- Fail --> E
      E --> K