Skip to content

Leading zeros with FORMAT_GEO_OUT=ddd:mm.ss.xx #7475

Closed

Description

@anbj
  • Based on forumpost.

  • Will implement parts of More FORMAT_GEO_MAP/OUT format options #5153.

  • There is an advantage of having fixed widths for coordinates to reduce ambiguity.

  • Request: implement an option (or make if default - minimizing ambiguity pr. default is always wise) to have fixed width - i.e coordinates get leading/trailing zeros. The output in the current version is:

    $ echo 7.54353543 9.1342 | gmt convert -fg --FORMAT_GEO_OUT=ddd:mm.xxxF
    07:32.612E      09:08.052N
    

    Proposed new output: 007:32.612E 09:08.052N.

Activity

  1. added
    feature request
    on May 25, 2023
  2. remkos commented on Jul 19, 2023

    @remkos
    Contributor

    Were are now implementing this. In fact you pointed out a bug here, because the longitude of course should always have had 3 digits for degrees.

    But there is something inconsistent between GMT_FORMAT_OUT and GMT_FORMAT_MAP. In the former ddd always got you leading zeros (although incorrectly as pointed out above), but in the latter it cut off the leading zeros.

    For GMT_FORMAT_MAP we are now implementing the syntax DDD to also get the leading zeros, with ddd not giving leading zeros.

    So I am suggesting to implement that both GMT_FORMAT_OUT and GMT_FORMAT_MAP will have two options for doing the degrees.

    • ddd to give degrees without leading zeros (this would change the outcome for GMT_FORMAT_OUT).
    • DDD to plot degrees with leading zeros. This would do the same for GMT_FORMAT_OUT as ddd did before.

    @anbj : would it be a problem for you if we change this syntax for GMT_FORMAT_OUT?

  3. anbj commented on Jul 19, 2023

    @anbj
    ContributorAuthor

    @remkos: absolutely no problem. This is great.

  4. remkos commented on Jul 19, 2023

    @remkos
    Contributor

    Thanks. We'll make it that way then, as in PR #7655

  5. anbj commented on Jul 19, 2023

    @anbj
    ContributorAuthor

    Great. I added a comment in one of the commits; it says two digits for longitude and three for latitude. Unless I’m very confused I think it should be three digits for longitude (0/360 or -180/180) and two digits for latitude (-90/90).

  6. anbj commented on Jul 20, 2023

    @anbj
    ContributorAuthor

    Fixed in 9e8e200.

  7. added a commit that references this issue on Jul 20, 2023
  8. remkos commented on Jul 21, 2023

    @remkos
    Contributor

    Fixed in 9e8e200.

    Thanks. Yes, I got confused somewhere.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions