UnitsOfMeasure implements Serializable { public static final double convertToDegrees(double distance, String unitsURI, double latitude) { UnitsOfMeasure units = new UnitsOfMeasure(unitsURI); if (units.isLinearUnits()) { double latitudeRadians = Math.toRadians(latitude); double longitudeRatio = Math.cos(latitudeRadians) * EQUATORIAL_DEGREE_TO_METRES; double metreDistance = UnitsOfMeasure.conversion(distance, units, METRE_UNITS); return cleanUpPrecision(metreDistance / longitudeRatio); } else { return UnitsOfMeasure.conversion(distance, units, DEGREE_UNITS); } } @SuppressWarnings("unchecked")  UnitsOfMeasure(CoordinateReferenceSystem crs); @SuppressWarnings("unchecked")  UnitsOfMeasure(String unitURI); Unit<Length> getUnit(); String getUnitURI(); boolean isLinearUnits(); static final Double conversion(double sourceDistance, String sourceDistanceUnitsURI, String targetDistanceUnitsURI); static final Double conversion(double sourceDistance, UnitsOfMeasure sourceUnits, UnitsOfMeasure targetUnits); static final double convertBetween(double distance, String unitsURI, String targetDistanceUnitsURI, boolean isTargetUnitsLinear, double latitude); static final double convertToDegrees(double distance, String unitsURI, double latitude); static final double convertToMetres(double distance, String unitsURI, double latitude); @Override String toString(); @Override int hashCode(); @Override boolean equals(Object obj
    ); static final UnitsOfMeasure METRE_UNITS; static final UnitsOfMeasure DEGREE_UNITS; static final double EQUATORIAL_DEGREE_TO_METRES; static final double EARTH_MEAN_RADIUS; }
@Test public void testConvert_0_degree() { double distance = 111319.9; String unitsURI = Unit_URI.METRE_URL; double latitude = 0.0; double expResult = 1.0; double result = UnitsOfMeasure.convertToDegrees(distance, unitsURI, latitude); assertEquals(expResult, result, 0.00001); }
@Test public void testConvert_23_degree() { double distance = 102470.508; String unitsURI = Unit_URI.METRE_URL; double latitude = 23.0; double expResult = 1.0; double result = UnitsOfMeasure.convertToDegrees(distance, unitsURI, latitude); assertEquals(expResult, result, 0.00001); }
@Test public void testConvert_45_degree() { double distance = 78715.05; String unitsURI = Unit_URI.METRE_URL; double latitude = 45.0; double expResult = 1.0; double result = UnitsOfMeasure.convertToDegrees(distance, unitsURI, latitude); assertEquals(expResult, result, 0.00001); }
@Test public void testConvert_67_degree() { double distance = 43496.15; String unitsURI = Unit_URI.METRE_URL; double latitude = 67.0; double expResult = 1.0; double result = UnitsOfMeasure.convertToDegrees(distance, unitsURI, latitude); assertEquals(expResult, result, 0.00001); }
@Test public void testConvert_67_degree2() { double distance = 1.0; String unitsURI = Unit_URI.DEGREE_URL; double latitude = 67.0; double expResult = 1.0; double result = UnitsOfMeasure.convertToDegrees(distance, unitsURI, latitude); assertEquals(expResult, result, 0.00001); }