java.lang.Object
org.gvsig.fmap.mapcontrol.tools.geo.Geo

public class Geo extends Object

Mathematical utilities to work with geographical data:

  • Geographical constants:
    • PI / 2.
    • Degrees per radian.
    • Square miles per spherical degree.
    • Square kilometres per spherical degree.
    • Square metres per spherical degree.
  • Decimal degrees equivalent to m meters.
  • The area of a spherical polygon in spherical degrees, given the latitudes and longitudes of n points, according the Haversine function.

Author:
Vicente Caballero Navarro
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static double
    Degrees per radian.
    static double
    PI / 2, having PI = 3.14159265358979323846
    static double
    Square kilometres per spherical degree.
    static double
    Square metres per spherical degree.
    static double
    Square miles per spherical degree.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Geo()
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    Gets the decimal degrees equivalent to the m meters.
    static double
    sphericalPolyArea(double[] lat, double[] lon, int n)
    Returns the area of a spherical polygon in spherical degrees, given the latitudes and longitudes in lat and lon, respectively.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • HalfPi

      public static double HalfPi
      PI / 2, having PI = 3.14159265358979323846
    • Degree

      public static double Degree
      Degrees per radian.
    • SqMi

      public static double SqMi
      Square miles per spherical degree.
    • SqKm

      public static double SqKm
      Square kilometres per spherical degree.
    • SqM

      public static double SqM
      Square metres per spherical degree.
  • Constructor Details

    • Geo

      public Geo()
  • Method Details

    • getDecimalDegrees

      public static double getDecimalDegrees(double m)

      Gets the decimal degrees equivalent to the m meters.

      Uses this formula:
      m * R * PI, having R = Radius of the Earth at the equator

      Parameters:
      m - distance value in meters
      Returns:
      m * Radius at the equator
    • sphericalPolyArea

      public static double sphericalPolyArea(double[] lat, double[] lon, int n)

      Returns the area of a spherical polygon in spherical degrees, given the latitudes and longitudes in lat and lon, respectively.

      The n data points have indexes which range from 0 to N-1.

      Uses the Haversine function for calculating the spherical area of the polygon.

      Parameters:
      lat - latitude of the vertexes (must be in radians)
      lon - longitude of the vertexes (must be in radians)
      n - number of vertexes in the polygon
      Returns:
      the area of a spherical polygon in spherical degrees