Fwd: Similarity index for pairs of features with the highest overlap?
Jim Klassen
klassen.js at gmail.com
Wed Nov 5 05:48:38 PST 2025
The usual approach I've seen in evaluating a remote sensing
classification is the confusion matrix [1]
I'd either rasterize the polygons at whatever resolution seems
appropriate and compute the confusion matrix from the rasters, or split
the one polygon layer with the other and take the areas of each
resulting polygon and assign them based on if they are in one, the
other, both, or neither.
[1] https://en.wikipedia.org/wiki/Confusion_matrix
On 11/4/25 06:19, celati Laurent wrote:
> Dear all,
>
> A few weeks ago, I posted an initial message:
>
> https://lists.osgeo.org/pipermail/postgis-users/2025-October/046930.html
> <https://lists.osgeo.org/pipermail/postgis-users/2025-October/046930.html>
>
> But after further thought, I'm creating a new one to provide
> additional inputs/clarification.
> As a reminder, my goal is to find a method/tool to compare the
> similarity/dissimilarity between two polygonal vector layers
> consisting of multiple features. In my use case, this comparison
> concerns a polygonal layer resulting from photo-interpretation work
> (modeling of large physiognomic units/habitats). I reattached a
> screenshot; this layer appears in blue.
> The other polygonal vector layer is a polygonal vector layer resulting
> from a segmentation process (using an OTB tool available via QGIS).
> (It is yellow in the attached screenshot):
>
> SS_seg_PI_identifiants.png
>
>
> In my previous post, I mentioned a possible way for one similarity
> indicator: "for each photo-interpreted feature/polygon, calculate the
> percentage (%) of area covered by the feature from the segmentation
> layer that has the highest overlap."
> To be more specific, in the example in the screenshot, it could be:
> "for feature number 11 (blue) from the photo-interpretation layer, I
> would like to know the proportion of the area covered by the feature
> from the segmentation layer that has the highest overlap with this
> feature 11 (in this specific case, it is probably feature 42 in yellow)."
> This could be: area of feature 42 overlapping with feature 11 / total
> area of feature 11.
>
> But after further thought, I think this is insufficient. That i need
> to go a little further.
>
> Regarding these methods for quantifying the accuracy of a
> segmentation/fidelity to photo-interpretation. Regarding the
> level/degree of similarity, I think i should integrate a
> "bi-similarity" aspect/logic: using an approach based *on pairs* of
> the most overlapping polygons:
>
> *step 1*
> - For each polygon feature in the input layer, retrieve the ID and
> geometry of the polygon from the segmentation layer that has the
> highest overlap. Calculate the overlap rate.
> (e.g., surface area of feature 42 overlapping with feature 11 / *total
> surface area of feature 11*).
> *
> Step 2:*
> - Once this first indicator is calculated, perform the calculation for
> the same pair/sequence of polygons calculated in step 1: perform the
> same calculation but this time on the total surface area of feature 42
> (polygon from the segmentation).
> (e.g., surface area of feature 42 overlapping with feature 11 /*total
> surface area of feature 42*).
>
> *Step 1/2 variant:*
> I was thinking that a one-step variant/synthesis/summary of steps 1
> and 2 could be:
> - (e.g., surface area of feature 42 overlapping with feature 11 /
> *total surface area constituted by feature 11 AND feature 42).*?
>
> * Step 3:*
> The idea would be, based on steps 1/2, to have a kind of overall score
> at the layer level. This could be a kind of average/median for all
> pairs of polygons? Or another metric?
>
> I imagine that this tool does not exist/is not available in QGIS.
> Although I discovered this plugin:
> https://plugins.qgis.org/plugins/similarity_plugin/#plugin-about
> https://github.com/panickspa/SimilarityPlugin
>
> Interesting plugin. But in my humble opinion, it only covers part of
> my need.
> To be complete, I did some research on the internet. I also found a
> potentially interesting indicator:
> https://postgis.net/docs/ST_HausdorffDistance.html
> https://en.wikipedia.org/wiki/Hausdorff_distance
>
> Is there a possible way, either through QGIS or PostGIS?
> Thanks so much.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20251105/bae63857/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SS_seg_PI_identifiants.png
Type: image/png
Size: 228559 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20251105/bae63857/attachment.png>
More information about the postgis-users
mailing list