<div dir="ltr"><div class="gmail_quote gmail_quote_container"><div dir="ltr"><div><div>Dear all, </div><div><br></div><div>A few weeks ago, I posted an initial message:</div><a href="https://lists.osgeo.org/pipermail/postgis-users/2025-October/046930.html"><br>https://lists.osgeo.org/pipermail/postgis-users/2025-October/046930.html</a><br><br>But after further thought, I'm creating a new one to provide additional inputs/clarification.<br>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.<br>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):<br><br><img src="cid:ii_mhkjbjxq1" alt="SS_seg_PI_identifiants.png" width="578" height="278"><br><br><br>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."<br>To be more specific, in the example in the screenshot, it could be:<br>"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)."<br>This could be: area of feature 42 overlapping with feature 11 / total area of feature 11.<br><br>But after further thought, I think this is insufficient. That i need to go a little further.<br><br>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 <b>on pairs</b> of the most overlapping polygons:<br><br><b>step 1</b><br>- 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.<br>(e.g., surface area of feature 42 overlapping with feature 11 / <b>total surface area of feature 11</b>).<br><b><br>Step 2:</b><br>- 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).<br>(e.g., surface area of feature 42 overlapping with feature 11 /<b> total surface area of feature 42</b>).<br><br><b>Step 1/2 variant:</b><br>I was thinking that a one-step variant/synthesis/summary of steps 1 and 2 could be:<br>- (e.g., surface area of feature 42 overlapping with feature 11 / <b>total surface area constituted by feature 11 AND feature 42).</b>?<br><br><b> Step 3:</b><br>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?<br><br>I imagine that this tool does not exist/is not available in QGIS. Although I discovered this plugin:<br><a href="https://plugins.qgis.org/plugins/similarity_plugin/#plugin-about" target="_blank">https://plugins.qgis.org/plugins/similarity_plugin/#plugin-about</a><br><a href="https://github.com/panickspa/SimilarityPlugin" target="_blank">https://github.com/panickspa/SimilarityPlugin</a><br><br>Interesting plugin. But in my humble opinion, it only covers part of my need.<br>To be complete, I did some research on the internet. I also found a potentially interesting indicator:<br><a href="https://postgis.net/docs/ST_HausdorffDistance.html" target="_blank">https://postgis.net/docs/ST_HausdorffDistance.html</a><br><a href="https://en.wikipedia.org/wiki/Hausdorff_distance" target="_blank">https://en.wikipedia.org/wiki/Hausdorff_distance</a><br><br>Is there a possible way, either through QGIS or PostGIS?<br></div>Thanks so much.</div>
</div></div>