grb.update_featurecollection_to_actual_grb
be.grb.grb.update_featurecollection_to_actual_grb(
featurecollection,
id_theme_fieldname=None,
base_metadata_field=METADATA_FIELD_NAME,
grb_type=GRBType.ADP,
max_distance_for_actualisation=2.0,
max_predictions=-1,
full_reference_strategy=FullReferenceStrategy.NO_FULL_REFERENCE,
multi_to_best_prediction=True,
feedback=None,
crs=DEFAULT_CRS,
attributes=True,
max_workers=None,
)Update a thematic feature collection to the most recent version of the GRB.
This function automates the alignment process by first identifying which features are ‘affected’ by changes in the GRB reference layer within a specific timeframe. It then calculates and evaluates new alignment predictions for those affected features.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| featurecollection | Dict[str, Any] | The thematic data as a GeoJSON-like dictionary. | required |
| id_theme_fieldname | str | The property field name containing the unique ID for each feature. | None |
| base_metadata_field | str | Name of the attribute field that stores the existing alignment observation (JSON string). This is used to determine the last version date. | OBSERVATION_FIELD_NAME |
| grb_type | GRBType | The type of GRB reference data to align against. | GRBType.ADP |
| max_distance_for_actualisation | float | Maximum distance (in meters) to search for potential alignments. The function checks intervals of 0.1m up to this value. | 2.0 |
| max_predictions | int | Maximum number of alignment predictions to return. -1 returns all. | -1 |
| full_reference_strategy | FullReferenceStrategy | Determines the prediction score when evaluating predictions, so predictions that are based on full-reference-geometries can be preferred. | NO_FULL_REFERENCE |
| multi_to_best_prediction | bool | If True, the prediction with the best prediction score is returned when multiple predictions are found If False, the original geometry is returned when multiple predictions are found | True. Only useful when max_predictions=1 |
| feedback | Any | Feedback object (e.g., QgsFeedback) for progress reporting and logging (in QGIS). | None |
| crs | str | The Coordinate Reference System for processing. | DEFAULT_CRS |
| attributes | bool | Whether to include the original thematic attributes in the result. | True |
| max_workers | int | The number of parallel threads to use for processing. | None |
Returns
| Name | Type | Description |
|---|---|---|
| Dict[str, Any] | A GeoJSON-like dictionary containing the evaluated predictions and updated alignment observations. |
Notes
The function follows a specific lifecycle to optimize performance:
- Initialization: Loads thematic data and the actual GRB reference data.
- Temporal Analysis: Extracts the
last_version_datefrom the features’ observations to determine the relevant GRB change-window. - Spatial Filtering: Uses
get_affected_by_grb_changeto isolate only those geometries where the underlying GRB has actually changed. - Alignment: Executes the
Aligner.evaluatelogic only on ‘affected’ features.
Raises
| Name | Type | Description |
|---|---|---|
| ValueError | If the CRS is unsupported or if the input feature collection is malformed. |