Closed joa-quim closed 5 years ago
I am not sure it can. Walter wrote this decades ago and I think it is sphere only.
It's not what I meant. Sure making project work on the ellipsoid it's not the point. But the -jg options seems odd. Either default to Sphere, or even make mapproject default to -je.
But we have supported this behavior forever: Ellipsoid is used for mapping and we approximate geodesics with great circles using the authalic radius. Would be backwards trouble if we changed this, no?
It's like mapproject needing a small -R to avoid spherical (autalic?). I think all of these root on 20 years CPU reasons where ellipsoidal was rather expensive. But now? -j is a GMT6 option so we would not be breaking anything. Only the default change to ellipsoidal.
This is the only place -j enters (in _gmt_initdistaz where we initialize distances calculations for programs such as map project and others):
/* Determine if -j selected a particular mode */
if (gmt_M_is_geographic (GMT, GMT_IN) && GMT->common.j.active) { /* User specified a -j setting */
static char *kind[5] = {"Cartesian", "Flat Earth", "Great Circle", "Geodesic", "Loxodrome"};
GMT_Report (GMT->parent, GMT_MSG_DEBUG, "Spherical distance calculation mode: %s.\n", kind[GMT->common.j.active]);
if (mode != GMT_GREATCIRCLE) /* We override a selection due to deprecated leading -|+ signs before increment or radius */
GMT_Report (GMT->parent, GMT_MSG_VERBOSE, "Your distance mode (%s) differs from your -j option (%s) which takes precedence.\n", kind[mode], kind[GMT->common.j.active]);
mode = GMT->common.j.mode; /* Override with what -j said */
}
So if -j is not given then we don't go there - hence hard to switch to a default of ellipsoidal since we let map project and other modules do this via the leading + on the distances unit (-G+u+k for instance). It is cleaner to stick with the long default and add -je to change to ellipsoidal. I would be very afraid of trying to find all the places where we assume great circle initializations and try to fix that versus sticking with the current model. I think it remains true that for most applications the great circle is perfectly good (plotting in particular) but when you know you need to top precision and accuracy then you also know you need -je.
OK, but why the great circle is not over Sphere instead of derived spheres of an ellipsoid? This comes up when comparing with others (or even ourselves, see project) and we get different answers not immediately knowing why.
Well, because an approximate geodesic is closer to the truth than spherical great circle, but at no additional cost.
Yes, it has a cost. The one of being different (nor Sphere not Ellipsoid) and users (me included when I forget about this again) being confused if they compare with different softwares.
Point is the cost has been paid all along. Sounds like the solution for now is to spell this out more clearly then. Where should it go? You want something in project and then where?
Yes, project clearly. Here too https://docs.generic-mapping-tools.org/dev/ternary.html#unit-attributes
but even mapproject -G
could say right away something like
Calculate distances along track (default to ellipsoid spherical authalic radius)
Closed by #1550.
See these examples
So by default -jg use the authalic radius of the selected ellipsoid, whilst project uses a Sphere. Reading again the docs, the -jg behavior is documented but not so much that of project. For consistency, shouldn't it allow, and default, to -jg?