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

Consider non-planar calculations in profile tool #48270

Open
2 tasks
saberraz opened this issue Apr 19, 2022 · 7 comments
Open
2 tasks

Consider non-planar calculations in profile tool #48270

saberraz opened this issue Apr 19, 2022 · 7 comments

Comments

@saberraz
Copy link
Contributor

saberraz commented Apr 19, 2022

What is the bug or the crash?

The distance (x axis) appears to be incorrect:

The identify tool displays the distance to be slightly less than 80km. But the same line appears to be over 100km in the profile tool along x axis. Ping me for the data and I can share it with you.
image

Steps to reproduce the issue

1- Load a GPX dataset
2- Create a profile
3- Compare the length from identify tool vs. x axis.

Versions

QGIS master

Supported QGIS version

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

New profile

  • I tried with a new QGIS profile

Additional context

No response

@saberraz saberraz added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label Apr 19, 2022
@Pedro-Murteira Pedro-Murteira added the Map Tools Related to non-digitizing map tools label Apr 19, 2022
@nicogodet
Copy link
Member

@saberraz project CRS ?
Looks similar to a current issue in plugin 😅

PANOimagen/profiletool#65

@saberraz
Copy link
Contributor Author

3857!

@nyalldawson
Copy link
Collaborator

This is not a trivial fix, if indeed it is a bug.

The profile tool is based entirely on planar calculations in the project's selected CRS, not ellipsoidal/great circle distances. I honestly doubt it's feasible at this stage to create a ellipsoidal aware profile tool -- the underlying libraries like libgeographic which we use for handling ellipsoidal calculations just don't have any capacity for handling elevations (I suspect because the mathematics required for these are horrendously complex!).

Non-planar profiles would open a whole bunch of related questions too... eg if I draw a long enough profile line, would I expect to see the Earth's curvature shown in the profile chart? And if so, then you'd also expect to see vertical features drawn perpendicular to the surface from their base point. Or would the profile line always be considered as occurring along the surface of the ellipsoid?

Leaving everything as planar and requiring users to make a suitable local projection choice is an acceptable limitation in my view.

We could consider adding a check and user facing warning here though, e.g. by measuring the profile line's ellipsoidal length and comparing against it's cartesian length, and if the difference exceeds say 2% then show a warning advising the user that their choice of CRS is misleading and to review this choice.

@nyalldawson nyalldawson added Feature Request and removed Bug Either a bug report, or a bug fix. Let's hope for the latter! labels Apr 19, 2022
@nyalldawson nyalldawson changed the title Wrong distance in the profile tool Consider non-planar calculations in profile tool Apr 19, 2022
@saberraz
Copy link
Contributor Author

I am easy with a warning. Another safer option would be to block users from creating the profile altogether if the difference is more than 2% and show a warning message.

@gacarrillor
Copy link
Member

With the introduction of the QgsProfileSourceRegistry (see this), this issue might need to be reconsidered.

We use distance/height calculations from the Swiss National Mapping Agency (Swisstopo) via web API.
Numbers indicate we get ellipsoidal distances. When visualizing the results on a project with EPSG:3857, we get significant distance deviations.

image

@nyalldawson, could we override the profile canvas' max width with the max distance we get from the API (or with the max distance from all profiles sources available) to get rid of this issue?

See opengisch/qgis-swiss-locator#86

@nyalldawson
Copy link
Collaborator

@gacarrillor

could we override the profile canvas' max width with the max distance we get from the API (or with the max distance from all profiles sources available) to get rid of this issue?

I'm -1 to that -- we'll just be providing obfuscated incorrect values if we go that route. This would still be my preferred approach:

We could consider adding a check and user facing warning here though, e.g. by measuring the profile line's ellipsoidal length and comparing against it's cartesian length, and if the difference exceeds say 2% then show a warning advising the user that their choice of CRS is misleading and to review this choice.

@gacarrillor
Copy link
Member

This would still be my preferred approach:

We could consider adding a check and user facing warning here though, e.g. by measuring the profile line's ellipsoidal length and comparing against it's cartesian length, and if the difference exceeds say 2% then show a warning advising the user that their choice of CRS is misleading and to review this choice.

Fair enough. We've switched to planar (2d) cartesian distances instead to stick to QGIS elevation profile functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants