com.isti.util.gis
Class GisUtils

java.lang.Object
  extended by com.isti.util.gis.GisUtils

public class GisUtils
extends java.lang.Object

Class GisUtils contains various static utility methods and constants for GIS.


Field Summary
static double DEG_TO_RAD
          Arc-degree to radian multiplier (pi / 180).
static double EARTH_EQUATORIAL_RADIUS_KM
          Earth radius in kilometers at equator (6378.1370).
static double EARTH_EQUATORIAL_RADIUS_METERS
          Earth radius in meters at equator (6378137.0).
static double FEET_TO_METER
          Feet to meters multiplier.
static double GEO_RADIUS
          GRS80 avg.
static double KM_TO_MILE
          Kilometers to miles multiplier.
static double METER_TO_FEET
          Meters to feet multiplier.
static double METER_TO_MILE
          Meters to miles multiplier.
static double MILE_TO_KM
          Miles to kilometers multiplier.
static double MILE_TO_METER
          Miles to meters multiplier.
static double RAD_TO_DEG
          Radian to arc-degree multiplier (180 / pi).
 
Method Summary
static double degreesToKm(double degVal)
          Converts a distance in degrees to kilometers.
static double kmToDegrees(double kmVal)
          Converts a distance in kilometers to degrees.
static double ptgAtan2(double a, double b)
          Atan2 function, with quadrant checks and traps for errors
static double sphereAzim(double rlat1, double rlon1, double rlat2, double rlon2)
          Calculates azimuth east of north on the surface of a sphere from point P1(lat,lon) to point P2(lat,lon) on the sphere.
static double sphereAzimDeg(double dlat1, double dlon1, double dlat2, double dlon2)
          Calculates azimuth east of north on the surface of a sphere from point P1(lat,lon) to point P2(lat,lon) on the sphere.
static double sphereDist(double dlat1, double dlon1, double dlat2, double dlon2)
          Calculates the great circle distance along the surface of the earth from point P1 (lat,lon) to point P2 (lat,lon) on the surface.
static double sphereDist(double rlat1, double rlon1, double rlat2, double rlon2, double dRadius)
          Calculates the great circle distance along the surface of a sphere from point P1 (lat,lon) to point P2 (lat,lon) on the surface.
static double sphereDistNew(double dlat0, double dlon0, double dlat1, double dlon1)
          Calculates the great circle distance along the surface of a sphere from point P1 (lat,lon) to point P2 (lat,lon) on the surface.
static double sphereDistNew(double rlat0, double rlon0, double rlat1, double rlon1, double dRadius)
          Calculates the great circle distance along the surface of a sphere from point P1 (lat,lon) to point P2 (lat,lon) on the surface.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FEET_TO_METER

public static final double FEET_TO_METER
Feet to meters multiplier.

See Also:
Constant Field Values

METER_TO_FEET

public static final double METER_TO_FEET
Meters to feet multiplier.

See Also:
Constant Field Values

MILE_TO_METER

public static final double MILE_TO_METER
Miles to meters multiplier.

See Also:
Constant Field Values

METER_TO_MILE

public static final double METER_TO_MILE
Meters to miles multiplier.

See Also:
Constant Field Values

MILE_TO_KM

public static final double MILE_TO_KM
Miles to kilometers multiplier.

See Also:
Constant Field Values

KM_TO_MILE

public static final double KM_TO_MILE
Kilometers to miles multiplier.

See Also:
Constant Field Values

DEG_TO_RAD

public static final double DEG_TO_RAD
Arc-degree to radian multiplier (pi / 180).

See Also:
Constant Field Values

RAD_TO_DEG

public static final double RAD_TO_DEG
Radian to arc-degree multiplier (180 / pi).

See Also:
Constant Field Values

GEO_RADIUS

public static final double GEO_RADIUS
GRS80 avg. earth radius, meters (6371008.7714).

See Also:
Constant Field Values

EARTH_EQUATORIAL_RADIUS_METERS

public static final double EARTH_EQUATORIAL_RADIUS_METERS
Earth radius in meters at equator (6378137.0).

See Also:
Constant Field Values

EARTH_EQUATORIAL_RADIUS_KM

public static final double EARTH_EQUATORIAL_RADIUS_KM
Earth radius in kilometers at equator (6378.1370).

See Also:
Constant Field Values
Method Detail

sphereDist

public static double sphereDist(double rlat1,
                                double rlon1,
                                double rlat2,
                                double rlon2,
                                double dRadius)
Calculates the great circle distance along the surface of a sphere from point P1 (lat,lon) to point P2 (lat,lon) on the surface. Uses sin(c/2) formula, which has high precision for distances from 0 to 180 degrees. Formula 5-3a from J.P.Snyder(1987), USGS Prof.Paper 1395, p30.

Parameters:
rlat1 - point 1 latitude in radians.
rlon1 - point 1 longitude in radians.
rlat2 - point 2 latitude in radians.
rlon2 - point 2 longitude in radians.
dRadius - radius of the sphere.
Returns:
The distance between the points, in meters.

sphereDist

public static double sphereDist(double dlat1,
                                double dlon1,
                                double dlat2,
                                double dlon2)
Calculates the great circle distance along the surface of the earth from point P1 (lat,lon) to point P2 (lat,lon) on the surface. Uses sin(c/2) formula, which has high precision for distances from 0 to 180 degrees. Formula 5-3a from J.P.Snyder(1987), USGS Prof.Paper 1395, p30.

Parameters:
dlat1 - point 1 latitude in degrees.
dlon1 - point 1 longitude in degrees.
dlat2 - point 2 latitude in degrees.
dlon2 - point 2 longitude in degrees.
Returns:
The distance between the points, in meters.

sphereAzim

public static double sphereAzim(double rlat1,
                                double rlon1,
                                double rlat2,
                                double rlon2)
Calculates azimuth east of north on the surface of a sphere from point P1(lat,lon) to point P2(lat,lon) on the sphere. Uses standard arcTangent formula, with adjustment for proper quadrant. Formula 5-4b from J.P.Snyder(1987), USGS Prof.Paper 1395, p30.

Parameters:
rlat1 - point 1 latitude in radians.
rlon1 - point 1 longitude in radians.
rlat2 - point 2 latitude in radians.
rlon2 - point 2 longitude in radians.
Returns:
Azimuth east of north in radians.

sphereAzimDeg

public static double sphereAzimDeg(double dlat1,
                                   double dlon1,
                                   double dlat2,
                                   double dlon2)
Calculates azimuth east of north on the surface of a sphere from point P1(lat,lon) to point P2(lat,lon) on the sphere. Uses standard arcTangent formula, with adjustment for proper quadrant. Uses degrees instead of radians. Formula 5-4b from J.P.Snyder(1987), USGS Prof.Paper 1395, p30.

Parameters:
dlat1 - point 1 latitude in degrees.
dlon1 - point 1 longitude in degrees.
dlat2 - point 2 latitude in degrees.
dlon2 - point 2 longitude in degrees.
Returns:
Azimuth east of north in degrees.

ptgAtan2

public static double ptgAtan2(double a,
                              double b)
Atan2 function, with quadrant checks and traps for errors

Parameters:
a - numerator of arctangent function
b - denominator of arctangent function
Returns:
arctangent

sphereDistNew

public static double sphereDistNew(double rlat0,
                                   double rlon0,
                                   double rlat1,
                                   double rlon1,
                                   double dRadius)
Calculates the great circle distance along the surface of a sphere from point P1 (lat,lon) to point P2 (lat,lon) on the surface. Uses formula provided by Bob Simpson (USGS).

Parameters:
rlat0 - point 0 latitude in radians.
rlon0 - point 0 longitude in radians.
rlat1 - point 1 latitude in radians.
rlon1 - point 1 longitude in radians.
dRadius - radius of the sphere.
Returns:
The distance between the points, in meters.

sphereDistNew

public static double sphereDistNew(double dlat0,
                                   double dlon0,
                                   double dlat1,
                                   double dlon1)
Calculates the great circle distance along the surface of a sphere from point P1 (lat,lon) to point P2 (lat,lon) on the surface. Uses formula provided by Bob Simpson (USGS).

Parameters:
dlat0 - point 0 latitude in degrees.
dlon0 - point 0 longitude in degrees.
dlat1 - point 1 latitude in degrees.
dlon1 - point 1 longitude in degrees.
Returns:
The distance between the points, in meters.

kmToDegrees

public static double kmToDegrees(double kmVal)
Converts a distance in kilometers to degrees.

Parameters:
kmVal - kilometers value to use.
Returns:
The distance value in degrees.

degreesToKm

public static double degreesToKm(double degVal)
Converts a distance in degrees to kilometers.

Parameters:
degVal - degrees value to use.
Returns:
The distance value in kilometers.