Class Geo
java.lang.Object
org.gvsig.fmap.mapcontrol.tools.geo.Geo
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
FieldsModifier and TypeFieldDescriptionstatic doubleDegrees per radian.static doublePI / 2, having PI = 3.14159265358979323846static doubleSquare kilometres per spherical degree.static doubleSquare metres per spherical degree.static doubleSquare miles per spherical degree. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doublegetDecimalDegrees(double m) Gets the decimal degrees equivalent to the m meters.static doublesphericalPolyArea(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.
-
Field Details
-
HalfPi
public static double HalfPiPI / 2, having PI = 3.14159265358979323846 -
Degree
public static double DegreeDegrees per radian. -
SqMi
public static double SqMiSquare miles per spherical degree. -
SqKm
public static double SqKmSquare kilometres per spherical degree. -
SqM
public static double SqMSquare 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
-