@@ -212,7 +212,7 @@ static void Free_Ctrl (struct GMT_CTRL *GMT, struct MAPPROJECT_CTRL *C) { /* Dea
212212static int usage (struct GMTAPI_CTRL * API , int level ) {
213213 const char * name = gmt_show_name_and_purpose (API , THIS_MODULE_LIB , THIS_MODULE_CLASSIC_NAME , THIS_MODULE_PURPOSE );
214214 if (level == GMT_MODULE_PURPOSE ) return (GMT_NOERROR );
215- GMT_Usage (API , 0 , "usage: %s <table> [-Ab|B|f|F|o|O [<lon0>/<lat0>][+v]] [-C[<dx></dy>][+m]] [-D%s] "
215+ GMT_Usage (API , 0 , "usage: %s <table> [-Ab|f|o [<lon0>/<lat0>][+v]] [-C[<dx></dy>][+m]] [-D%s] "
216216 "[-E[<datum>]] [-F[<%s|%s>]] [-G[<lon0>/<lat0>][+a][+i][+u<unit>][+v]] [-I] [%s] [-L<table>[+p][+u<unit>]] "
217217 "[-N[a|c|g|m]] [-Q[d|e]] [%s] [-S] [-T[h]<from>[/<to>]] [%s] [-W[b|B|e|E|g|h|j|m|M|n|o|O|r|R|w|x]][+n[<nx>[/<ny>]]] [-Z[<speed>][+a][+i][+f][+t<epoch>]] "
218218 "[%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s] [%s]\n" ,
@@ -228,17 +228,15 @@ static int usage (struct GMTAPI_CTRL *API, int level) {
228228 GMT_Option (API , "<" );
229229
230230 GMT_Message (API , GMT_TIME_NONE , "\n OPTIONAL ARGUMENTS:\n" );
231- GMT_Usage (API , 1 , "\n-Ab|B|f|F|o|O [<lon0>/<lat0>][+v]" );
231+ GMT_Usage (API , 1 , "\n-Ab|f|o [<lon0>/<lat0>][+v]" );
232232 GMT_Usage (API , -2 , "Calculate azimuths from previous point in the input data with -Af. If <lon0>/<lat0> "
233233 "is provided, then all azimuths are computed with respect to that point. Select directive:" );
234234 GMT_Usage (API , 3 , "b: Calculate back-azimuths from data to previous or the specified point on the sphere." );
235- GMT_Usage (API , 3 , "B: Calculate back-azimuths from data to previous or the specified point on the ellipsoid." );
236235 GMT_Usage (API , 3 , "f: Calculate azimuths from data to previous or the specified point on the sphere." );
237- GMT_Usage (API , 3 , "F: Calculate back-azimuths from data to previous or the specified point on the ellipsoid." );
238236 GMT_Usage (API , 3 , "o: Calculate orientations (-90/90) instead of azimuths (0/360) on the sphere." );
239- GMT_Usage (API , 3 , "O: Calculate orientations (-90/90) instead of azimuths (0/360) on the ellipsoid." );
240237 GMT_Usage (API , -2 , "Append +v to obtain variable <lon0> <lat0> points from input columns 3-4 instead. "
241238 "If -R -J are given then we compute Cartesian angles after projecting the coordinates." );
239+ GMT_Usage (API , -2 , "Use -je option to do the computations on the ellipsoid instead of the sphere." );
242240 GMT_Usage (API , 1 , "\n-C[<dx></dy>][+m]" );
243241 GMT_Usage (API , -2 , "Get projected coordinates relative to projection center [Default is relative to lower left corner]. "
244242 "Optionally append <dx></dy> to add (or subtract if -I) (i.e., false easting and northing) [0/0]. "
@@ -473,7 +471,7 @@ GMT_LOCAL unsigned int mapproject_old_G_parser (struct GMT_CTRL *GMT, char *arg,
473471 return (n_errors );
474472}
475473
476- static int parse (struct GMT_CTRL * GMT , struct MAPPROJECT_CTRL * Ctrl , struct GMT_OPTION * options ) {
474+ static int parse (struct GMT_CTRL * GMT , struct MAPPROJECT_CTRL * Ctrl , struct GMT_OPTION * options ) {
477475 /* This parses the options provided to mapproject and sets parameters in CTRL.
478476 * Any GMT common options will override values set previously by other commands.
479477 * It also replaces any file names specified as input or output with the data ID
@@ -811,6 +809,16 @@ static int parse (struct GMT_CTRL *GMT, struct MAPPROJECT_CTRL *Ctrl, struct GMT
811809
812810 if (n_errors ) return GMT_PARSE_ERROR ; /* Might as well return here since otherwise we may get some false warnings from below as well */
813811
812+ /* -AF|B will fail if input is not detected as geog (unfortunally easy happens). On the other hand,
813+ it ignores the -j option. This patch will force the input to be recognized as geographic. And allows
814+ as to drop the upper case directives (old stuff?) in favor of -j alone.
815+ */
816+ if (Ctrl -> A .active && (Ctrl -> A .geodesic || (GMT -> common .j .active && GMT -> common .j .mode >= GMT_GREATCIRCLE ))) {
817+ GMT -> current .io .col_type [GMT_IN ][GMT_X ] = GMT_IS_LON ;
818+ GMT -> current .io .col_type [GMT_IN ][GMT_Y ] = GMT_IS_LAT ;
819+ if (GMT -> common .j .mode == GMT_GEODESIC ) Ctrl -> A .geodesic = true; /* If -je set Ctrl->A.geodesic to avoid annoying warning */
820+ }
821+
814822 geodetic_calc = (Ctrl -> G .mode || Ctrl -> A .active || Ctrl -> L .active );
815823 no_JR_needed = (Ctrl -> A .active || Ctrl -> E .active || Ctrl -> G .active || Ctrl -> L .active || Ctrl -> N .active || Ctrl -> Z .active );
816824 if (GMT -> common .J .width_given ) will_need_RJ = true; /* Need -R -J to convert width to scale */
0 commit comments