-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QGIS Expression - overlay_intersects #59408
Comments
I add a demo: 2024-11-11_14h03_45.mp4 |
@elpaso, may you have a look at this? I would assume it should contain the area / length of the geometry resulting from the intersection between the current feature's geometry and each intersecting feature from the layer whose intersection is checked. When the geometry resulting from the intersection is composed by a single part, that assumption seems correct. Moreover, when the geometry resulting from the intersection is composed by e.g. a polygon and a line (i.e. a GeometryCollection), then the resulting array item is missing in the function result. |
It's been a while but looking at the specifications the The goal of this implementation was to have a tool to identify small (difficult to catch by eye) imperfections in the digitized shapes, to be corrected manually, having the max value allows to filter for intersections that are below a small given value. When the result of an intersection is a geometry collection of different geometry types the design decision was to return nothing. So, it seems to me that this is the expected behavior, perhaps we can clarify it in the documentation. |
@andreasneumann maybe you remember better than me if this is the expected behavior. I am happy to fix this if it is confirmed to be a bug. |
@elpaso I used this at my previous employer Kanton Solothurn. They care only about area/area overlaps and did not care about the length of lines in the intersection areas. So we did not test this behaviour back then. So I think it would be good to fix this, if the behaviour is like @pigreco describes. |
Happy to fix it as I said, but the thing is that I am having an hard time to understand what would be the expected behavior (i.e. if there is a bug or not). Returning the total length of the overlapping segments at first makes sense but it would be different than the behavior for polygons which by design returns the biggest overlapping part (so that you can easily filter for overlaps below a certain threshold). As far as geometry collections are the result of an intersection what should we return instead of nothing: the length, the area or both? |
Summarizing: we have two separate topics here:
|
@elpaso, I'm not sure to understand the purpose of such design logic. Please see the following examples:
|
Partial fix for qgis#59408 - try to merge multilinestrings to get the max length - consider the tested geomery type when intersection is a collection Funded by: Body & Soul 🎵
Partial fix for qgis#59408 - try to merge multilinestrings to get the max length - consider the tested geomery type when intersection is a collection Funded by: Body & Soul ♬
I respect your opinion about what makes sense to you but you must admit that others may see that differently. IIRC the use case was to identify accidental/unwanted overlapping polygons, this means that if the result of the intersection between polygons has multiple parts (if we have only one part we all agree about the expected behavior) in order to decide whether this is accidental or not you are not interest in the smallest intersection neither in the sum of the intersections but in the value of the biggest one, because if the largest intersection is bigger than x it you can reasonably suppose that the overlap between the two features couldn't happen by mistake, so you can make a filter to return all the features that have an intersection (with their biggest part, if multi) smaller than x to fetch the list of potential mistakes to be manually checked. It makes sense to me and most certainly to who commissioned and funded this work. Now I can understand that there are other use cases where the report details may behave differently but I'm not gonna change the established behavior: you may turn this ticket into a feature request but it is definitely not a bug (except for the documentation enhancement). @agiudiceandrea So, what I am going to fix is your
Case number 2 shows the expected behavior. |
Ok, but I only discovered the use case now, before it was not explained anywhere. Then, it is a use case not very intuitive and therefore for me it was a bug. The sum of the parts is instead intuitive and is very useful in data analysis. thanks for the time dedicated, for me we can close the issue |
@elpaso Grazie mille!!! |
I close the issue because I understand that there is no will to fix it (and maybe it's late to do so) I would like to understand how many people use these new options, in my opinion no one. regards |
I'm reopening the issue, maybe it's necessary to merge the related PR? |
Partial fix for qgis#59408 - try to merge multilinestrings to get the max length - consider the tested geomery type when intersection is a collection Funded by: Body & Soul ♬
Partial fix for qgis#59408 - try to merge multilinestrings to get the max length - consider the tested geomery type when intersection is a collection Funded by: Body & Soul ♬
Partial fix for qgis#59408 - try to merge multilinestrings to get the max length - consider the tested geomery type when intersection is a collection Funded by: Body & Soul ♬
Partial fix for #59408 - try to merge multilinestrings to get the max length - consider the tested geomery type when intersection is a collection Funded by: Body & Soul ♬
What is the bug or the crash?
I noticed that using the
return_details
andsort_by_intersection_size
options does not give the expected results.If the object to evaluate has more parts or is multipart, the output is incorrect, that is, the output returns only the length (or area) of the largest part.
In the image below I highlight the fact that the L-shaped segment is calculated only the length of the longest segment.

In the case of Multipolygon with separate parts, the area of the largest overlap is calculated and not the overall area.

Steps to reproduce the issue
I attach an example project (use the views to correctly display the two cases)I attach an example project (use the views to correctly display the two cases)
progetto_overlap.zip
https://discourse.osgeo.org/t/espressione-di-qgis-overlay-intersects/111118/1
Versions
The problem is present on QGIS 3.34.12, QGIS 3.40.0 and the master
Supported QGIS version
New profile
Additional context
No response
The text was updated successfully, but these errors were encountered: