I am custom formatting my coordinate grid.

Is there a way to change the following formula so that the output comes with a decimal and suffix?

substr(@grid_number, length(@grid_number) -6,5)  

The following provides a suffix, but again I need this to be with less digits like above and a decimal:

abs(@grid_number ) 
|| ' °' 
|| CASE 
    WHEN  @grid_axis = 'x' 
         IF (@grid_number > 0, 'E' , 'W')
           IF (@grid_number > 0, 'N' , 'S')

Perhaps there is a way to combine the two so that I can achieve a coordinate format like the following:


  • use the round() function if you want a number with fewer digits. If the number is stored as a string you might need to use the to_real function to convert it to a number. – csk Aug 20 at 17:41
  • 3
    are you sure you want minutes before degrees? that's a very confusing format. – csk Aug 20 at 17:42
  • @csk this question looks ripe for an answer based on your comments – PolyGeo Oct 20 at 2:04

Your Answer


Browse other questions tagged or ask your own question.