toSexagesimal method

String toSexagesimal()

Converts lat/long values into sexagesimal

final LatLng p1 = new LatLng(51.519475, -19.37555556);

// Shows: 51° 31' 10.11" N, 19° 22' 32.00" W
print(p1..toSexagesimal());

Implementation

String toSexagesimal() {
    String latDirection = latitude >= 0 ? "N" : "S";
    String lonDirection = longitude >= 0 ? "O" : "W";
    return "${decimal2sexagesimal(latitude)} ${latDirection}, ${decimal2sexagesimal(longitude)} ${lonDirection}";
}