use of org.gavaghan.geodesy.GlobalCoordinates in project adif-processor by urbancamo.
the class CommaSeparatedDecimalLatLongParserTest method test.
@Test
public void test() {
String input = "54.370985339290684,-2.9098945771236493";
double latitude = 54.370985339290684;
double longitude = -2.9098945771236493;
GlobalCoordinates coords = new CommaSeparatedDecimalLatLongParser().parse(LocationSource.UNDEFINED, input);
assertNotNull("Coords is null", coords);
assertTrue(Math.abs(coords.getLatitude() - latitude) < 0.0001);
assertTrue(Math.abs(coords.getLongitude() - longitude) < 0.0001);
}
use of org.gavaghan.geodesy.GlobalCoordinates in project adif-processor by urbancamo.
the class CommaSeparatedDecimalWithNsewLatLongParserTest method test.
@Test
public void test() {
String input = "49.6850503S, 13.0318131W";
double latitude = -49.6850503;
double longitude = -13.0318131;
GlobalCoordinates coords = new CommaSeparatedDecimalWithNsewLatLongParser().parse(LocationSource.UNDEFINED, input);
assertNotNull("Coords is null", coords);
assertTrue(Math.abs(coords.getLatitude() - latitude) < 0.0001);
assertTrue(Math.abs(coords.getLongitude() - longitude) < 0.0001);
}
use of org.gavaghan.geodesy.GlobalCoordinates in project adif-processor by urbancamo.
the class DegreesMinutesDecimalSecondsLatLongFormatterTest method check.
private void check(String input, Double latitude, Double longitude) {
DegreesMinutesDecimalSecondsWithNsewLatLongParser dms = new DegreesMinutesDecimalSecondsWithNsewLatLongParser();
GlobalCoordinates coords = dms.parse(LocationSource.UNDEFINED, input);
assertNotNull("Coords is null", coords);
assertTrue(Math.abs(coords.getLatitude() - latitude) < 0.0001);
assertTrue(Math.abs(coords.getLongitude() - longitude) < 0.0001);
// Right now check the formatted output matches
String formatted = dms.format(coords);
assertEquals(String.format("Formatted String: %s doesn't match expected: %s", formatted, input), formatted, input);
}
use of org.gavaghan.geodesy.GlobalCoordinates in project adif-processor by urbancamo.
the class DegreesMinutesDecimalSecondsWithNsewLatLongParserTest method checkFormat.
private void checkFormat(String expected, Double latitude, Double longitude) {
GlobalCoordinates coords = new GlobalCoords3D(latitude, longitude);
String formatted = new DegreesMinutesDecimalSecondsWithNsewLatLongParser().format(coords);
assertEquals(formatted, expected);
}
use of org.gavaghan.geodesy.GlobalCoordinates in project adif-processor by urbancamo.
the class DegreesMinutesSecondsLatLongParserTest method check.
private void check(String input, Double latitude, Double longitude) {
GlobalCoordinates coords = new DegreesMinutesSecondsWithNsewLatLongParser().parse(LocationSource.UNDEFINED, input);
assertNotNull("Coords is null", coords);
assertTrue(Math.abs(coords.getLatitude() - latitude) < 0.0001);
assertTrue(Math.abs(coords.getLongitude() - longitude) < 0.0001);
}
Aggregations