Search in sources :

Example 1 with GlobalCoordinates

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);
}
Also used : GlobalCoordinates(org.gavaghan.geodesy.GlobalCoordinates) Test(org.junit.Test)

Example 2 with GlobalCoordinates

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);
}
Also used : GlobalCoordinates(org.gavaghan.geodesy.GlobalCoordinates) Test(org.junit.Test)

Example 3 with GlobalCoordinates

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);
}
Also used : GlobalCoordinates(org.gavaghan.geodesy.GlobalCoordinates)

Example 4 with GlobalCoordinates

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);
}
Also used : GlobalCoordinates(org.gavaghan.geodesy.GlobalCoordinates)

Example 5 with GlobalCoordinates

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);
}
Also used : GlobalCoordinates(org.gavaghan.geodesy.GlobalCoordinates)

Aggregations

GlobalCoordinates (org.gavaghan.geodesy.GlobalCoordinates)34 GeodeticCurve (org.gavaghan.geodesy.GeodeticCurve)9 GeodeticCalculator (org.gavaghan.geodesy.GeodeticCalculator)5 Test (org.junit.Test)5 Adif3Record (org.marsik.ham.adif.Adif3Record)3 GlobalCoords3D (uk.m0nom.coords.GlobalCoords3D)3 IOException (java.io.IOException)2 ArrayList (java.util.ArrayList)2 Ellipsoid (org.gavaghan.geodesy.Ellipsoid)2 PropagationApex (uk.m0nom.comms.PropagationApex)2 GeneralPath (armyc2.c2sd.graphics2d.GeneralPath)1 Document (de.micromata.opengis.kml.v_2_2_0.Document)1 Folder (de.micromata.opengis.kml.v_2_2_0.Folder)1 Kml (de.micromata.opengis.kml.v_2_2_0.Kml)1 BufferedReader (java.io.BufferedReader)1 EOFException (java.io.EOFException)1 File (java.io.File)1 Reader (java.io.Reader)1 UnmappableCharacterException (java.nio.charset.UnmappableCharacterException)1 java.time (java.time)1