-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Fix issue with vertical lines not visible in the elevation profile tool #58959
base: master
Are you sure you want to change the base?
Conversation
…equest.setDistanceWithin` when tolerance>0 as some providers as improved performances with setDistanceWithin" This reverts commit ce96dee. This commit was introduced to gain some performance when the `tolerance` is set by using `request.setDistanceWithin` instead of `request.setFilterRect`. However, in that case, the providers either use `GEOS::distance` or `GEOS::distanceWithin` which is not able to handle the Z component of a Geometry. For example, a purely vertical line, i.e.: `LineString(X Y Z1, X Y Z2)` will always be to an infinite distance of any geometry according to GEOS. In practice, this means that a purely vertical line will never be visible in the elevation profile when the tolerance is set. Indeed, the provider will always discard such geometry because of the usage of `setDistanceWithin`. This issue is fixed by always using `setFilterRect`. This might introduce a performance penalty but this ensures that the result is always correct.
…ines See the previous commit
42d217c
to
2e5df52
Compare
I think this special case should be handled in the iterator (or geometry) classes then, not specifically the elevation profile code |
Thanks for you message. However, I don't understand it. Do you mean that the iterator code of the providers should be changed? Or something else? |
. Do you mean that the iterator code of the providers should be changed? I mean if the setDistanceWithin method for QgsFeatureRequest can't handle this situation, then it needs to be fixed in the iterator code. Otherwise other users of setDistanceWithin will remain broken. So maybe the fix needs to apply in QgsGeos::distance / QgsGeos::distanceWithin instead, eg by detecting a vertical line and using a GEOS point geometry there instead... |
Description
This PR reverts commit ce96dee.
This commit was introduced to gain some performance when the
tolerance
is set by usingrequest.setDistanceWithin
instead ofrequest.setFilterRect
. However, in that case, the providers eitheruse
GEOS::distance
orGEOS::distanceWithin
which is not able tohandle the Z component of a Geometry.
For example, a purely vertical line, i.e.:
LineString(X Y Z1, X Y Z2)
will always be to an infinite distance of any geometry accordingto GEOS.
In practice, this means that a purely vertical line will never be
visible in the elevation profile when the tolerance is set. Indeed,
the provider will always discard such geometry because of the usage
of
setDistanceWithin
. This issue is fixed by always usingsetFilterRect
. This might introduce a performance penalty but thisensures that the result is always correct.