Spatial Metrics
analyze_geometric_similarity(manual, automated, id_col='tree_id')
Performs a comprehensive similarity analysis between two matched vector layers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
manual
|
Vector
|
Reference manual crown vector. |
required |
automated
|
Vector
|
Automated crown vector for comparison. |
required |
id_col
|
str
|
Join column present in both datasets. |
'tree_id'
|
Returns:
| Type | Description |
|---|---|
DataFrame
|
pd.DataFrame: A table containing matched IDs and all computed spatial metrics. |
Source code in src/phytospatial/vector/spatial_metrics.py
compute_ciou(geom_a, geom_b)
Computes the Complete Intersection over Union (CIoU).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geom_a
|
Vector
|
The first geometry. |
required |
geom_b
|
Vector
|
The second geometry. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The CIoU metric value. |
Source code in src/phytospatial/vector/spatial_metrics.py
compute_dice(geom_a, geom_b)
Computes the Dice similarity coefficient (Sørensen–Dice index).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geom_a
|
Vector
|
The first geometry. |
required |
geom_b
|
Vector
|
The second geometry. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
2 * intersection area divided by the sum of individual areas. |
Source code in src/phytospatial/vector/spatial_metrics.py
compute_diou(geom_a, geom_b)
Computes the Distance Intersection over Union (DIoU).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geom_a
|
Vector
|
The first geometry. |
required |
geom_b
|
Vector
|
The second geometry. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The DIoU metric value. |
Source code in src/phytospatial/vector/spatial_metrics.py
compute_giou(geom_a, geom_b)
Computes the Generalized Intersection over Union (GIoU).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geom_a
|
Vector
|
The first geometry. |
required |
geom_b
|
Vector
|
The second geometry. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The GIoU metric value. |
Source code in src/phytospatial/vector/spatial_metrics.py
compute_iou(geom_a, geom_b)
Computes the Intersection over Union (IoU) for two spatial geometries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
geom_a
|
Vector
|
The first geometry |
required |
geom_b
|
Vector
|
The second geometry |
required |
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The intersection area divided by the union area. |