Class GeoUtils

java.lang.Object
edu.cnu.mdi.mapping.util.GeoUtils

public class GeoUtils extends Object
Utility class for geographic coordinate conversions using the WGS84 ellipsoid.

Supports bidirectional conversion between:

  • Radians (longitude, latitude) as Point2D.Double — the internal representation used by the mapping system
  • UTM (Universal Transverse Mercator) as UTMCoordinate
  • Decimal degrees as a convenience intermediate

Coordinate convention: All Point2D.Double values used here follow the mapping convention where .x = longitude and .y = latitude, both in radians.

Accuracy: The UTM implementation uses the standard transverse Mercator series expansion (Bowring/Snyder approach). Accuracy is better than 1 mm within the standard UTM zone bounds (±3° from the central meridian). Results degrade gracefully outside those bounds but are not intended for use beyond ±10°.

Coverage: Valid for latitudes -80° to +84° (the defined UTM coverage area). Polar regions require a separate UPS implementation.

See Also:
  • Method Details

    • fromRadians

      public static UTMCoordinate fromRadians(Point2D.Double latLonRad)
      Converts a geographic position given in radians to a UTMCoordinate.
      Parameters:
      latLonRad - the position to convert; .x = longitude in radians, .y = latitude in radians
      Returns:
      the corresponding UTM coordinate on the WGS84 ellipsoid, or (per fromDecimalDegrees(double, double)) an out-of-range sentinel coordinate (see UTMCoordinate(boolean)) if the latitude falls outside the UTM-defined range of -80° to +84° — this method never throws for an out-of-range latitude
    • fromDecimalDegrees

      public static UTMCoordinate fromDecimalDegrees(double latDeg, double lonDeg)
      Converts a geographic position given in decimal degrees to a UTMCoordinate.
      Parameters:
      latDeg - latitude in decimal degrees, positive north (-80 to +84)
      lonDeg - longitude in decimal degrees, positive east (-180 to +180)
      Returns:
      the corresponding UTM coordinate on the WGS84 ellipsoid
    • toRadians

      public static Point2D.Double toRadians(UTMCoordinate utm)
      Converts a UTMCoordinate to a geographic position in radians.
      Parameters:
      utm - the UTM coordinate to convert
      Returns:
      the corresponding geographic position; .x = longitude in radians, .y = latitude in radians
      Throws:
      IllegalArgumentException - if the UTM zone number is not in the range 1 to 60
    • toDecimalDegrees

      public static double[] toDecimalDegrees(UTMCoordinate utm)
      Converts a UTMCoordinate to decimal degrees (latitude, longitude).
      Parameters:
      utm - the UTM coordinate to convert
      Returns:
      a two-element array [latitudeDeg, longitudeDeg]
      Throws:
      IllegalArgumentException - if the UTM zone number is not in the range 1 to 60