AlignerResult

aligner.AlignerResult(process_results)

Stores and processes the results from the alignment operation.

This class manages the lifecycle of alignment results, including enrichment with geometric metrics (like area or length change), filtering by result type, and exporting to GeoJSON format.

Attributes

Name Type Description
results Dict[ThematicId, Dict[float, Optional[ProcessResult]]] A nested dictionary where the outer key is the theme ID and the inner key is the relevant distance used during processing.
metadata Optional[Any] Optional metadata about the overall alignment operation.

Notes

The class acts as a post-processor. It takes the raw output from the geometric engines and calculates semantic differences before exporting.

graph TD
    Raw[Raw Process Results] --> AR[AlignerResult]
    AR --> |get_results| Enriched[Enriched with Area/Length Metrics]
    Enriched --> |get_results_as_geojson| GeoJSON[GeoJSON FeatureCollection]
    GeoJSON --> |save_results| Disk[Local .geojson files]

Examples

>>> # Initializing and saving results
>>> result_obj = AlignerResult(raw_results)
>>> result_obj.save_results(aligner, path="./output_folder")

Methods

Name Description
get_results Retrieves results enriched with geometric metrics and filtered by type.
get_results_as_geojson Converts the results into a GeoJSON FeatureCollection format.
save_results Exports the results as multiple GeoJSON files to a directory.

get_results

aligner.AlignerResult.get_results(
    aligner,
    result_type=AlignerResultType.PROCESSRESULTS,
)

Retrieves results enriched with geometric metrics and filtered by type.

This method mutates the stored ProcessResult objects by adding calculated difference metrics (e.g., symmetrical area change) to their properties.

Parameters

Name Type Description Default
aligner Aligner The ‘Aligner’ object used to access thematic data and comparison logic. required
result_type AlignerResultType Filters the results based on status. Defaults to PROCESSRESULTS. AlignerResultType.PROCESSRESULTS

Returns

Name Type Description
Dict[ThematicId, Dict[float, Optional[ProcessResult]]] A dictionary of filtered and enriched results.

Raises

Name Type Description
ValueError If an unsupported result_type is provided.

get_results_as_geojson

aligner.AlignerResult.get_results_as_geojson(
    aligner,
    result_type=AlignerResultType.PROCESSRESULTS,
    add_metadata=False,
    add_original_attributes=False,
)

Converts the results into a GeoJSON FeatureCollection format.

Parameters

Name Type Description Default
aligner Aligner The ‘Aligner’ object providing CRS and thematic metadata. required
result_type AlignerResultType The type of results to export. Defaults to PROCESSRESULTS. AlignerResultType.PROCESSRESULTS
add_metadata bool If True, includes the descriptive comparison observation in properties. False
add_original_attributes bool If True, includes original thematic attributes in the output. False

Returns

Name Type Description
Dict[str, Any] A dictionary representing a GeoJSON FeatureCollection.

Raises

Name Type Description
ValueError If self.results is empty or None.

save_results

aligner.AlignerResult.save_results(
    aligner,
    path,
    result_type=AlignerResultType.PROCESSRESULTS,
    add_metadata=False,
    add_original_attributes=False,
)

Exports the results as multiple GeoJSON files to a directory.

Creates separate files for original results, differences, and specific area changes (added/removed).

Parameters

Name Type Description Default
aligner Aligner The ‘Aligner’ object for spatial context. required
path str Target directory path where files will be created. required
result_type AlignerResultType Type of results to export. Defaults to PROCESSRESULTS. AlignerResultType.PROCESSRESULTS
add_metadata bool Whether to include alignment observations in the output. False
add_original_attributes bool Whether to include original feature attributes. False

Notes

The output files follow the naming convention: {result_type}_{name}.geojson.