org.deegree.cs.utilities
Class ProjectionUtils

java.lang.Object
  extended by org.deegree.cs.utilities.ProjectionUtils

public class ProjectionUtils
extends Object

The Utils class combines some helpful constants and forms.

Version:
$Revision: 30120 $, $Date: 2011-03-22 10:04:15 +0100 (Tue, 22 Mar 2011) $
Author:
Rutger Bezema, last edited by: $Author: aschmitz $

Field Summary
static double DTR
          Degrees to Radians (Math.PI/180.0)
static double EPS10
          A small epsilon value
static double EPS11
          An even smaller epsilon value
static double HALFPI
          Cotaining the value 0.5*pi
static double QUARTERPI
          Containing the value 0.25*pi
static double RTD
          Radians to Degrees (180.0/Math.PI)
static double TWOPI
          Containing the value 2*pi
static Rectangle2D WORLD_BOUNDS
          The max and min of the projected word map in degrees (-180, -90, 360, 180)
static Rectangle2D WORLD_BOUNDS_RAD
          The max and min of the projected word map in radians (-Math.PI, -HALFPI, TWOPI, Math.PI)
 
Constructor Summary
ProjectionUtils()
           
 
Method Summary
static double acosScaled(double value)
          A helper method, which returns the acos from value or if value < -1 pi or value>1 0.
static double asinScaled(double value)
          A helper method, which returns the asin from value or if value < -1 (-pi/2) or value>1 (pi/2).
static double authlat(double beta, double[] APA)
          Deprecated. use calcPhiFromAuthalicLatitude(double, double[]) instead.;
static double[] authset(double eccentricitySquared)
          Deprecated. use getAuthalicLatitudeSeriesValues(double) instead.;
static double calcMFromSnyder(double sinphi, double cosphi, double eccentricitySquared)
          This method can be used to calculate the value of a variable called 'm' by Snyder (Snyder p.101 14-15).
static double calcPhiFromAuthalicLatitude(double beta, double[] APA)
          Gets phi from the authalic latitude beta and the precalculated values of the adams?
static double calcPhiFromConformalLatitude(double chi, double[] APA)
          Gets Phi from the given conformal latitude chi and the precalculated values (gotten from preCalcedThetaSeries(double) ) of the adams?
static double calcPhiFromMeridianDistance(double initialValue, double squaredEccentricity, double[] en)
          This method calcs lattitude phi from a given distance along the meridian to the equator for a a given ellispoid and is therefore the inverse of the getDistanceAlongMeridian(double, double, double, double[]).
static double calcQForAuthalicLatitude(double sinphi, double eccentricity)
          From the proj4 library, to determine small q which is needed to calculate the authalic (equal-areaed) latitude beta, on a sphere having the same surface area as the ellipsoid, relative to the ellipsoid.
static double conformalLatitudeInnerPart(double phi, double sinphi, double eccentricity)
          This method calculates the innerpart of the conformal latitude's definition (Snyder p.15 3-1).
static double decMinSecToRadians(double inCoord)
          Converts a Deegree.MinSec value into it's radian equivalent.
static double[] enfn(double es)
          Deprecated. Use getRectifiyingLatitudeValues(double) instead
static double[] getAuthalicLatitudeSeriesValues(double eccentricitySquared)
          Pre-Calculates the values (used for the adams?
static double getDistanceAlongMeridian(double phi, double sphi, double cphi, double[] en)
          This method calcs the distance along the meridian from the equator to latitude phi for a a given ellispoid Snyder (p.17 3-21).
static double[] getRectifiyingLatitudeValues(double es)
          Pre Calculates the values for the series to calculate for a given ellipsoid with given eccentricity the distance along the meridian from the equator to a given latitude getDistanceAlongMeridian(double, double, double, double[]).
static double inv_mlfn(double initialValue, double squaredEccentricity, double[] en)
          Deprecated. Use calcPhiFromMeridianDistance(double,double,double[]) instead
static double length(double dx, double dy)
          Calcs the length of a vector given by two points x and y
static double mlfn(double phi, double sphi, double cphi, double[] en)
          Deprecated. Use getDistanceAlongMeridian(double,double,double,double[]) instead
static double msfn(double sinphi, double cosphi, double eccentricitySquared)
          Deprecated. Use calcMFromSnyder(double,double,double) instead
static double normalizeLatitude(double angle)
          A helper method modulos (pi)the given angle (in radians) until the result fits betwee -HALFPI and HALF_PI.
static double normalizeLongitude(double angle)
          A helper method modulos (2*pi)the given angle (in radians) until the result fits betwee -PI and PI.
static double[] preCalcedThetaSeries(double eccentricitySquared)
          Pre-Calculates the values (used for the adams?
static double qsfn(double sinphi, double e)
          Deprecated. use calcQForAuthalicLatitude(double, double) instead.
static double radiansToDecMinSec(double inCoord)
          Converts a radian to its Deegree.MinSec equivalent.
static double ssfn(double phi, double sinphi, double eccentricity)
          Deprecated. Use conformalLatitudeInnerPart(double,double,double) instead
static double tanHalfCoLatitude(double phi, double sinphi, double eccentricity)
          This method calculates the tangens of the half colatitude from the conformal latitude (Snyder p.108 15-9).
static double tsfn(double phi, double sinphi, double eccentricity)
          Deprecated. Use tanHalfCoLatitude(double,double,double) instead
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EPS10

public static final double EPS10
A small epsilon value

See Also:
Constant Field Values

EPS11

public static final double EPS11
An even smaller epsilon value

See Also:
Constant Field Values

HALFPI

public static final double HALFPI
Cotaining the value 0.5*pi

See Also:
Constant Field Values

QUARTERPI

public static final double QUARTERPI
Containing the value 0.25*pi

See Also:
Constant Field Values

TWOPI

public static final double TWOPI
Containing the value 2*pi

See Also:
Constant Field Values

RTD

public static final double RTD
Radians to Degrees (180.0/Math.PI)

See Also:
Constant Field Values

DTR

public static final double DTR
Degrees to Radians (Math.PI/180.0)

See Also:
Constant Field Values

WORLD_BOUNDS_RAD

public static final Rectangle2D WORLD_BOUNDS_RAD
The max and min of the projected word map in radians (-Math.PI, -HALFPI, TWOPI, Math.PI)


WORLD_BOUNDS

public static final Rectangle2D WORLD_BOUNDS
The max and min of the projected word map in degrees (-180, -90, 360, 180)

Constructor Detail

ProjectionUtils

public ProjectionUtils()
Method Detail

qsfn

@Deprecated
public static double qsfn(double sinphi,
                                     double e)
Deprecated. use calcQForAuthalicLatitude(double, double) instead.

From the proj4 library, to determine small q which is needed to calculate the authalic (equal-areaed) latitude beta, on a sphere having the same surface area as the ellipsoid, relative to the ellipsoid. Snyder (3 -12).

Parameters:
sinphi - the sine of the angle between the positive z-axis and the line formed between the origin and P.
e - the eccentricity
Returns:
the q value from Snyder (3-12)

calcQForAuthalicLatitude

public static double calcQForAuthalicLatitude(double sinphi,
                                              double eccentricity)
From the proj4 library, to determine small q which is needed to calculate the authalic (equal-areaed) latitude beta, on a sphere having the same surface area as the ellipsoid, relative to the ellipsoid. Snyder (3 -12).

Parameters:
sinphi - the sine of the angle between the positive z-axis and the line formed between the origin and P.
eccentricity - the eccentricity of the ellipsoid to map the sphere to.
Returns:
the q value from Snyder (3-12)

preCalcedThetaSeries

public static double[] preCalcedThetaSeries(double eccentricitySquared)
Pre-Calculates the values (used for the adams? series) which will be used to calculate the phi value of an inverse projection. Snyder (3-5).

Parameters:
eccentricitySquared - the squared eccentricity from the ellipsoid to calculate the theta for.
Returns:
the precalculated values.

calcPhiFromConformalLatitude

public static double calcPhiFromConformalLatitude(double chi,
                                                  double[] APA)
Gets Phi from the given conformal latitude chi and the precalculated values (gotten from preCalcedThetaSeries(double) ) of the adams? serie. From Snyder (3-5).

Parameters:
chi - the conformal latitude
APA - the precalculated values from the serie gotten from preCalcedThetaSeries(double).
Returns:
the Phi as a polarcoordinate on the ellipsoid or chi if the length of APA != 4.

authset

@Deprecated
public static double[] authset(double eccentricitySquared)
Deprecated. use getAuthalicLatitudeSeriesValues(double) instead.;

Pre-Calculates the values (used for the adams? series) which will be used to calculate the authalic latitude. Snyder (3-18).

Parameters:
eccentricitySquared - the squared eccentricity from the ellipsoid to calculate the authalic latitude for.
Returns:
the precalculated values.

getAuthalicLatitudeSeriesValues

public static double[] getAuthalicLatitudeSeriesValues(double eccentricitySquared)
Pre-Calculates the values (used for the adams? series) which will be used to calculate the authalic latitude. Snyder (3-18).

Parameters:
eccentricitySquared - the squared eccentricity from the ellipsoid to calculate the authalic latitude for.
Returns:
the precalculated values [0] = e^2/3 + e^4*(31/180) + e^6*(517/5040), [1]= e^4*(23/360) + e^6*(251/3780) and [2] = e^6*(761/45360).

authlat

@Deprecated
public static double authlat(double beta,
                                        double[] APA)
Deprecated. use calcPhiFromAuthalicLatitude(double, double[]) instead.;

Gets phi from the authalic latitude beta and the precalculated values of the adams? serie. From Snyder (3-18).

Parameters:
beta - authalic latitude.
APA - the precalculated values from the series gotten from getAuthalicLatitudeSeriesValues(double).
Returns:
the phi on the ellipsoid.

calcPhiFromAuthalicLatitude

public static double calcPhiFromAuthalicLatitude(double beta,
                                                 double[] APA)
Gets phi from the authalic latitude beta and the precalculated values of the adams? serie. From Snyder (3-18).

Parameters:
beta - authalic latitude.
APA - the precalculated values from the serie gotten from getAuthalicLatitudeSeriesValues(double).
Returns:
the phi on the ellipsoid.

length

public static double length(double dx,
                            double dy)
Calcs the length of a vector given by two points x and y

Parameters:
dx - of the vector
dy - of the vector
Returns:
the length

conformalLatitudeInnerPart

public static double conformalLatitudeInnerPart(double phi,
                                                double sinphi,
                                                double eccentricity)
This method calculates the innerpart of the conformal latitude's definition (Snyder p.15 3-1). This formula is almost equal to the calculation of the half colatitude from the conformal latitude (Snyder p.108 15-9). They only differ a sign in the first term.

Parameters:
phi - to calculate the conformal latitude from
sinphi - the sinus of the phi.
eccentricity - of the ellipsoid to which the phi should be made conformal to.
Returns:
the value of the innerpart of the conformal latitude formula. i.e. tan( pi/4 + phi/2)*[(1-e*sin(phi))/1+e*sin(phi))]^e/2.

ssfn

@Deprecated
public static double ssfn(double phi,
                                     double sinphi,
                                     double eccentricity)
Deprecated. Use conformalLatitudeInnerPart(double,double,double) instead

This method calculates the innerpart of the conformal latitude's definition (Snyder p.15 3-1). This formula is almost equal to the calculation of the half colatitude from the conformal latitude (Snyder p.108 15-9). They only differ a sign in the first term.

Parameters:
phi - to calculate the conformal latitude from
sinphi - the sinus of the phi.
eccentricity - of the ellipsoid to which the phi should be made conformal to.
Returns:
the value of the innerpart of the conformal latitude formula. i.e. tan( pi/4 + phi/2)*[(1-e*sin(phi))/1+e*sin(phi))]^e/2.

tanHalfCoLatitude

public static double tanHalfCoLatitude(double phi,
                                       double sinphi,
                                       double eccentricity)
This method calculates the tangens of the half colatitude from the conformal latitude (Snyder p.108 15-9).

Parameters:
phi - to calculate the half of the co latitude of the conformal latitude from
sinphi - the sinus of the phi.
eccentricity - of the ellipsoid to which the phi should be made conformal to.
Returns:
the value of the tangens of half of the conformal latitude formula. i.e. tan( pi/4 - phi/2)/[(1-e*sin(phi))/1+e*sin(phi))]^e/2.

tsfn

@Deprecated
public static double tsfn(double phi,
                                     double sinphi,
                                     double eccentricity)
Deprecated. Use tanHalfCoLatitude(double,double,double) instead

This method calculates the tangens of the half colatitude from the conformal latitude (Snyder p.108 15-9). This formula is almost equal to the calculation of the innerpart of the conformal latitude's definition (Snyder p.15 3-1). They only differ a sign in the first term.

Parameters:
phi - to calculate the half of the co latitude of the conformal latitude from
sinphi - the sinus of the phi.
eccentricity - of the ellipsoid to which the phi should be made conformal to.
Returns:
the value of the innerpart of the conformal latitude formula (given sign + or -). i.e. tan( pi/4 (+-) phi/2)*[(1-e*sin(phi))/1+e*sin(phi))]^e/2.

msfn

@Deprecated
public static double msfn(double sinphi,
                                     double cosphi,
                                     double eccentricitySquared)
Deprecated. Use calcMFromSnyder(double,double,double) instead

This method can be used to calculate the value of a variable called 'm' by Snyder (Snyder p.101 14-15).

Parameters:
sinphi - the sinus of the phi
cosphi - the cosinus of the phi
eccentricitySquared - the value eccentricity * eccentricity.
Returns:
cos( phi) / Math.sqrt( 1 - eccentricity*eccentricity*sin(phi)*sin(phi) ).

calcMFromSnyder

public static double calcMFromSnyder(double sinphi,
                                     double cosphi,
                                     double eccentricitySquared)
This method can be used to calculate the value of a variable called 'm' by Snyder (Snyder p.101 14-15).

Parameters:
sinphi - the sinus of the phi
cosphi - the cosinus of the phi
eccentricitySquared - the value eccentricity * eccentricity.
Returns:
cos( phi) / Math.sqrt( 1 - eccentricity*eccentricity*sin(phi)*sin(phi) ).

enfn

@Deprecated
public static double[] enfn(double es)
Deprecated. Use getRectifiyingLatitudeValues(double) instead

Pre Calculates the values for the series to calculate for a given ellipsoid with given eccentricity the distance along the meridian from the equator to a given latitude getDistanceAlongMeridian(double, double, double, double[]).

Parameters:
es - the squared eccentricity of the underlying ellipsoid.
Returns:
the precalculated values for given ellipsoid.

getRectifiyingLatitudeValues

public static double[] getRectifiyingLatitudeValues(double es)
Pre Calculates the values for the series to calculate for a given ellipsoid with given eccentricity the distance along the meridian from the equator to a given latitude getDistanceAlongMeridian(double, double, double, double[]).

Parameters:
es - the squared eccentricity of the underlying ellipsoid.
Returns:
the precalculated values for given ellipsoid.

mlfn

@Deprecated
public static double mlfn(double phi,
                                     double sphi,
                                     double cphi,
                                     double[] en)
Deprecated. Use getDistanceAlongMeridian(double,double,double,double[]) instead

This method calcs for a a given ellispoid the distance along the meridian from the equator to latitude phi Snyder (p.17 3-21). It is used to calculate the rectifying latitude mu.

Parameters:
phi - the lattitude of the point in radians
sphi - the sinus of the latitude
cphi - the cosinus of the latitude
en - an array (of length 5) containing the precalculate values for this ellipsoid gotten from getRectifiyingLatitudeValues(double).
Returns:
the distance along the meridian from the equator to latitude phi.

getDistanceAlongMeridian

public static double getDistanceAlongMeridian(double phi,
                                              double sphi,
                                              double cphi,
                                              double[] en)
This method calcs the distance along the meridian from the equator to latitude phi for a a given ellispoid Snyder (p.17 3-21). It is used to calculate the rectifying latitude mu.

Parameters:
phi - the lattitude of the point in radians
sphi - the sinus of the latitude
cphi - the cosinus of the latitude
en - an array (of length 5) containing the precalculate values for this ellipsoid gotten from getRectifiyingLatitudeValues(double).
Returns:
the distance along the meridian from the equator to latitude phi.

inv_mlfn

@Deprecated
public static double inv_mlfn(double initialValue,
                                         double squaredEccentricity,
                                         double[] en)
Deprecated. Use calcPhiFromMeridianDistance(double,double,double[]) instead

This method calcs lattitude phi from a given distance along the meridian to the equator for a a given ellispoid and is therefore the inverse of the getDistanceAlongMeridian(double, double, double, double[]). Phi is determined to EPS (1e-11) radians, which is about 1e-6 seconds.

Parameters:
initialValue - to calculate phi from, a good starting value is using the (distance along the meridian / y*scale) e.g. the scaled y value on the meridian.
squaredEccentricity - the squared eccentricity of the ellipsoid.
en - an array (of length 5) containing the precalculate values for this ellipsoid gotten from getRectifiyingLatitudeValues(double).
Returns:
the lattitude phi.

calcPhiFromMeridianDistance

public static double calcPhiFromMeridianDistance(double initialValue,
                                                 double squaredEccentricity,
                                                 double[] en)
This method calcs lattitude phi from a given distance along the meridian to the equator for a a given ellispoid and is therefore the inverse of the getDistanceAlongMeridian(double, double, double, double[]). Phi is determined to EPS (1e-11) radians, which is about 1e-6 seconds.

Parameters:
initialValue - to calculate phi from, a good starting value is using the (distance along the meridian / y*scale) e.g. the scaled y value on the meridian.
squaredEccentricity - the squared eccentricity of the ellipsoid.
en - an array (of length 5) containing the precalculate values for this ellipsoid gotten from getRectifiyingLatitudeValues(double).
Returns:
the lattitude phi or the best approximated value if no suitable convergence was found.

acosScaled

public static double acosScaled(double value)
A helper method, which returns the acos from value or if value < -1 pi or value>1 0.

Parameters:
value - (in radians) from which the acos must be calculated
Returns:
the acos from value or if value < -1 pi or if value > 1 0.

asinScaled

public static double asinScaled(double value)
A helper method, which returns the asin from value or if value < -1 (-pi/2) or value>1 (pi/2).

Parameters:
value - (in radians) from which the asin must be calculated
Returns:
the asin from value or if value < -1 (-pi/2) or value>1 (pi/2).

normalizeLatitude

public static double normalizeLatitude(double angle)
A helper method modulos (pi)the given angle (in radians) until the result fits betwee -HALFPI and HALF_PI.

Parameters:
angle - in radians
Returns:
the angle adjusted to -pi/2 + pi/2 or 0 if the angle is NaN or Infinite.

normalizeLongitude

public static double normalizeLongitude(double angle)
A helper method modulos (2*pi)the given angle (in radians) until the result fits betwee -PI and PI.

Parameters:
angle - to be normalized
Returns:
the angle adjusted to -2*pi + pi*2 or 0 if the angle is NaN or Infinite.

decMinSecToRadians

public static double decMinSecToRadians(double inCoord)
Converts a Deegree.MinSec value into it's radian equivalent. for example 13.120637 dms -> 13.201769444444446° -> 0.23041434389473822 rd

Parameters:
inCoord - to be converted to radians.
Returns:
the radian equivalent of the inCoord.

radiansToDecMinSec

public static double radiansToDecMinSec(double inCoord)
Converts a radian to its Deegree.MinSec equivalent. For example 0.23041434389473822 rd -> 13.201769444444446° -> 13.120637 dms

Parameters:
inCoord - to be converted to degrees.minsec
Returns:
the radian equivalent of the inCoord.


Copyright © 2011. All Rights Reserved.