Convert decimal coordinate into degrees, minutes, seconds, direction

前端 未结 6 1751
遥遥无期
遥遥无期 2020-12-28 21:13

I have the following so far, but can\'t figure out a tidy way to get the direction letters in without a bunch of messy if statements. Any ideas? Ideally I\'d like to extend

6条回答
  •  半阙折子戏
    2020-12-28 21:53

    Standard way:

    char lonLetter = (lon > 0) ? 'E' : 'W';
    char latLetter = (lat > 0) ? 'N' : 'S';
    

提交回复
热议问题