static public String latToString ( double lat , int ndec ) { boolean is_north = ( lat >= 0.0 ) ; if ( ! is_north ) lat = - lat ; String f = "%." + ndec + "f" ; Formatter latBuff = new Formatter ( ) ; latBuff . format ( f , lat ) ; latBuff . format ( "%s" , is_north ? "N" : "S" ) ; return latBuff . toString ( ) ; }
Make a nicely formatted representation of a latitude eg 40 . 34N or 12 . 9S .