Skip to content

DMSValueFormatter with ICAO Geodetic Display Format (WGS-84) #41

Description

@gcng54

Hi,

I want to suggest about DMSValueFormatter formats. Its effect can be much.
So, after considering by you.
if you approve, I can try some changes.

Best regards.

for toDMSFormat----

format("%d°%d'%s"%c", degrees, minutes, secondsWithRelDigits, directionSymbol);

but in ICAO Geodetic Display Format (WGS-84) Format Specification is

Latitude: DD°MM'SS.S"N or S
Longitude: DDD°MM'SS.S"E or W
as
Latitude: 40°03'45.2"N
Longitude: 032°51'12.7"E

SS.S: Seconds with one decimal place (optional but common)
ICAO Annex 15 recommends at least 0.01 arc seconds precision

Describe the solution you'd like

I suggest you use this standart format.
I think, it needs changing on DMSValueFormatter and ValueFormatter also Test files.

Also, in LatitudeTest for default or zero value, it should not display full second decimal.
String latInDms = latitude.toDMSFormat();
assertThat(latInDms).isEqualTo("52°14'5.123000000003799"N");

Describe alternatives you've considered

public String toDMSFormat() {
    // return DMSValueFormatter.latitudeToDmsFormat(this, -1);
    return DMSValueFormatter.latitudeToDmsFormat(this, 2); 

private static String createDMSNotation(double coordinateInDegrees, char directionSymbol, int relevantDigits) {
   //  String secondsWithRelDigits = relevantDigits > 0
    String secondsWithRelDigits = relevantDigits >= 0

// format("%d°%d'%s"%c", degrees, minutes, secondsWithRelDigits, directionSymbol);
for latitude > format("%02d°%02d'%s"%c", degrees, minutes, secondsWithRelDigits, directionSymbol);
for longitude > format("%03d°%02d'%s"%c", degrees, minutes, secondsWithRelDigits, directionSymbol);

// formatValueToDecimalPlaces shoul have overload for arc second SS.S display
formatString = "#." + "#".repeat(numDecimalPlaces);

Additional context

https://docs.google.com/viewer?url=https%3A%2F%2Fskybrary.aero%2Fbookshelf%2Fbooks%2F5854.pdf

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions