Skip to content
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

Open
2 tasks done
pigreco opened this issue Nov 11, 2024 · 2 comments
Open
2 tasks done

QGIS Expression - overlay_intersects #59408

pigreco opened this issue Nov 11, 2024 · 2 comments
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Expressions Related to the QGIS expression engine or specific expression functions

Comments

@pigreco
Copy link
Contributor

pigreco commented Nov 11, 2024

What is the bug or the crash?

I noticed that using the return_details and sort_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.
image

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

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

Versione di QGIS3.41.0-Master
Revisione codice QGISfda2aa46e9
 
Librerie
Versione Qt5.15.13
Versione Python3.12.7
Versione GDAL/OGR3.11.0dev-b281c45d9a
Versione PROJ9.5.0
Versione database del Registro EPSGv11.016 (2024-08-31)
Versione GEOS3.13.0-CAPI-1.19.0
Versione SQLite3.46.1
Versione PDAL2.8.1
Versione client PostgreSQL16.2
Versione SpatiaLite5.1.0
Versione QWT6.3.0
Versione QScintilla22.14.1
Versione SOWindows 11 Version 2009
Questa copia di QGIS scrive messaggi di debug.
 
Plugins Python attivi
DataPlotly4.2.0
felt3.1.5
gps_replay0.0.5
HCMGIS24.10.20
mmqgis2021.9.10
nominatim_locator_filter0.3.2
profile-manager0.31
qconsolidate1.1.0
qduckdb1.0.1
quick_map_services0.19.34
relazioniplugin1.1
SelectionFilter1.0
db_manager0.1.20
MetaSearch0.3.6
processing2.12.99

The problem is present on QGIS 3.34.12, QGIS 3.40.0 and the master

Supported QGIS version

  • I'm running a supported QGIS version according to the roadmap.

New profile

Additional context

No response

@pigreco pigreco added Expressions Related to the QGIS expression engine or specific expression functions Bug Either a bug report, or a bug fix. Let's hope for the latter! labels Nov 11, 2024
@pigreco
Copy link
Contributor Author

pigreco commented Nov 11, 2024

I add a demo:
note that the L-shaped sides

2024-11-11_14h03_45.mp4

@agiudiceandrea
Copy link
Contributor

agiudiceandrea commented Nov 11, 2024

@elpaso, may you have a look at this?
From the docs and from the description of your PR #46683 it is unclear what the value of the 'overlap' key is supposed to contain exactly when the return_details parameter is set to true.

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.
When the geometry resulting from the intersection is composed by more then one part, then it looks like the value of the 'overlap' key contains the area / length of only (the greatest) one of the geometry's parts, instead of the area / length of the whole geometry.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter! Expressions Related to the QGIS expression engine or specific expression functions
Projects
None yet
Development

No branches or pull requests

2 participants