Class GCTPStyleProjection

All Implemented Interfaces:
Cloneable, ProjectionConstants
Direct Known Subclasses:
GCTPCStyleProjection

public abstract class GCTPStyleProjection extends MapProjection
The GCTPStyleProjection class provides various static constants and functions for classes that perform GCTP style projection computations. The functions are based directly on those from the GCTPC package.
Since:
3.2.1
Author:
Peter Hollemans
  • Field Details

    • PI

      public static final double PI
      The value of PI.
      See Also:
    • HALF_PI

      public static final double HALF_PI
      The value of PI/2.
      See Also:
    • TWO_PI

      public static final double TWO_PI
      The value of 2 PI.
      See Also:
    • EPSLN

      public static final double EPSLN
      The epsilon value for checking if numbers are very close.
      See Also:
    • R2D

      public static final double R2D
      Conversion from radians to degrees.
      See Also:
    • C3P

      public static final double C3P
      A useless quirky companion constant to go along with R2D.
      See Also:
    • D2R

      public static final double D2R
      Conversion from degrees to radians.
      See Also:
    • falseEast

      protected double falseEast
      The false easting value.
    • falseNorth

      protected double falseNorth
      The false northing value.
    • ec

      protected double ec
      The eccentricity value for the spheroid.
    • ec2

      protected double ec2
      The eccentricity value squared for the spheroid.
    • rMajor

      protected double rMajor
      The semi-major axis in meters.
  • Constructor Details

    • GCTPStyleProjection

      public GCTPStyleProjection(int system, int zone, double rMajor, double rMinor, int[] dimensions, AffineTransform affine) throws NoninvertibleTransformException
      Creates a GCTP style projection.
      Parameters:
      system - the map projection system.
      zone - the map projection zone for State Plane and UTM projections.
      rMajor - the semi-major axis in meters.
      rMinor - the semi-minor axis in meters.
      dimensions - the dimensions of the data grid as [rows, columns].
      affine - the affine transform for translating data [row, column] to map [x, y].
      Throws:
      NoninvertibleTransformException
  • Method Details

    • setDatum

      protected void setDatum(Datum datum)
      Sets the datum for this projection and pre-computes values needed and matching spheroid code.
      Parameters:
      datum - the new datum to use.
    • setFalse

      public void setFalse(double falseEast, double falseNorth)
      Sets the false east and north values. By default, these are both set to zero.
      Parameters:
      falseEast - the false easting value in meters.
      falseNorth - the false northing value in meters.
    • asinz

      public static double asinz(double con)
      Computes asin and eliminates roundoff error.
      Parameters:
      con - the value to compute the arc sine for.
      Returns:
      the arc sine of the value, in the range of -pi/2 through pi/2.
    • msfnz

      public static double msfnz(double eccent, double sinphi, double cosphi)
      Computes the constant small m which is the radius of a parallel of latitude, phi, divided by the semimajor axis.
      Parameters:
      eccent - the spheroid eccentricity.
      sinphi - sine of the latitude angle.
      cosphi - cosine of the latitude angle.
      Returns:
      the value m.
    • qsfnz

      public static double qsfnz(double eccent, double sinphi, double cosphi)
      Computes the constant small q which is the radius of a parallel of latitude, phi, divided by the semimajor axis.
      Parameters:
      eccent - the spheroid eccentricity.
      sinphi - sine of the latitude angle.
      cosphi - cosine of the latitude angle.
      Returns:
      the value q.
    • phi1z

      public static double phi1z(double eccent, double qs)
      Computes the value phi1, the latitude for the inverse of the Albers Conical Equal-Area projection.
      Parameters:
      eccent - the eccentricity angle in radians.
      qs - the angle in radians.
      Returns:
      the latitude angle in radians or Double.NaN if the iteration did not converge.
    • phi2z

      public static double phi2z(double eccent, double ts)
      Computes the latitude angle, phi2, for the inverse of the Lambert Conformal Conic and Polar Stereographic projections.
      Parameters:
      eccent - the spheroid eccentricity.
      ts - the constant value t.
      Returns:
      the latitude angle in radians or Double.NaN if the iteration did not converge.
    • phi3z

      public static double phi3z(double ml, double e0, double e1, double e2, double e3)
      Computes the latitude, phi3, for the inverse of the Equidistant Conic projection.
      Parameters:
      ml - the constant ml.
      e0 - the constant e0.
      e1 - the constant e1.
      e2 - the constant e2.
      e3 - the constant e3.
      Returns:
      the latitude angle in radians or Double.NaN if the iteration did not converge.
    • phi4z

      public static double phi4z(double eccent, double e0, double e1, double e2, double e3, double a, double b, double[] c)
      Computes phi4, the latitude for the inverse of the Polyconic projection.
      Parameters:
      eccent - the eccentricity squared.
      e0 - the constant e0.
      e1 - the constant e1.
      e2 - the constant e0.
      e3 - the constant e0.
      a - the constant e0.
      b - the constant e0.
      c - the constant c (modified).
      Returns:
      the latitude angle in radians or Double.NaN if the iteration did not converge.
    • pakcz

      public static double pakcz(double pak)
      Converts the 2 digit alternate packed DMS format (+/-)DDDMMSS.SSS to 3 digit standard packed DMS format (+/-)DDDMMMSSS.SSS.
      Parameters:
      pak - the angle in alternate packed DMS format.
      Returns:
      the angle packed in 3 digit format.
    • pakr2dm

      public static double pakr2dm(double pak)
      Converts radians to 3 digit packed DMS format (+/-)DDDMMMSSS.SSS.
      Parameters:
      pak - the angle in radians.
      Returns:
      the angle packed in 3 digits format.
    • e0fn

      public static double e0fn(double x)
      Computes the constant e0 which is used in a series for calculating the distance along a meridian.
      Parameters:
      x - the eccentricity squared.
      Returns:
      the constant e0.
    • e1fn

      public static double e1fn(double x)
      Computes the constant e1 which is used in a series for calculating the distance along a meridian.
      Parameters:
      x - the eccentricity squared.
      Returns:
      the constant e1.
    • e2fn

      public static double e2fn(double x)
      Computes the constant e2 which is used in a series for calculating the distance along a meridian.
      Parameters:
      x - the eccentricity squared.
      Returns:
      the constant e2.
    • e3fn

      public static double e3fn(double x)
      Computes the constant e3 which is used in a series for calculating the distance along a meridian.
      Parameters:
      x - the eccentricity squared.
      Returns:
      the constant e3.
    • e4fn

      public static double e4fn(double x)
      Computes the constant e4 used in the Polar Stereographic projection.
      Parameters:
      x - the eccentricity.
      Returns:
      the constant e4.
    • mlfn

      public static double mlfn(double e0, double e1, double e2, double e3, double phi)
      Computes the value of M which is the distance along a meridian from the Equator to latitude phi.
      Parameters:
      e0 - the constant e0.
      e1 - the constant e1.
      e2 - the constant e0.
      e3 - the constant e0.
      phi - the latitude value in radians.
      Returns:
      the distance value M.
    • calc_utm_zone

      public static int calc_utm_zone(double lon)
      Calculates the UTM zone number.
      Parameters:
      lon - the longitude in degrees.
      Returns:
      the UTM zone number.
    • sign

      public static int sign(double x)
      Gets the sign of a value.
      Parameters:
      x - the value to get the sign for.
      Returns:
      the sign of the value, -1 if the value is less than zero, or 1 otherwise.
    • tsfnz

      public static double tsfnz(double eccent, double phi, double sinphi)
      Computes the constant small t for use in the forward computations in the Lambert Conformal Conic and the Polar Stereographic projections.
      Parameters:
      eccent - the eccentricity of the spheroid.
      phi - the latitude phi in radians.
      sinphi - the sine of the latitude.
      Returns:
      the contant term t.
    • adjust_lon

      public static double adjust_lon(double x)
      Adjusts a longitude angle to be in the range [-180 .. 180] in radians.
      Parameters:
      x - the input longitude in radians.
      Returns:
      the adjusted longitude in radians.
    • sphdz

      public static void sphdz(int isph, double[] parm, double[] r_major, double[] r_minor, double[] radius)

      Gets the semi-major, semi-minor, and radius axes lengths based on the parameters and spheroid code. The following algorithm is used. If the spheroid code is negative, the first two values in the parameter array parm are used to define the values as follows:

      • If parm[0] is a non-zero value and parm[1] is greater than one, the semimajor axis and radius are set to parm[0] and the semiminor axis is set to parm[1].
      • If parm[0] is nonzero and parm[1] is greater than zero but less than or equal to one, the semimajor axis and radius are set to parm[0] and the semiminor axis is computed from the eccentricity squared value parm[1]. This algorithm is given below.
      • If parm[0] is nonzero and parm[1] is equal to zero, the semimajor axis, radius, and semiminor axis are set to parm[0].
      • If parm[0] equals zero and parm[1] is greater than zero, the default Clarke 1866 is used to assign values to the semimajor axis, radius and semiminor axis.
      • If parm[0] and parm[1] equals zero, the semimajor axis and radius are set to 6370997.0 and the semiminor axis is set to zero.

      If a spheroid code is zero or greater, the semimajor and semiminor axis are defined by the spheroid code arrays in the SpheroidConstants interface, and the radius is set to 6370997.0. If the spheroid code is greater than MAX_SPHEROIDS-1 the default spheroid, Clarke 1866, is used to define the semimajor and semiminor axis and radius is set to 6370997.0.

      The algorithm to define the semiminor axis using the eccentricity squared value is as follows:

         semiminor = sqrt(1.0 - ES) * semimajor
       

      where ES is the eccentricity squared.

      Parameters:
      isph - the spheroid code number.
      parm - the projection parameter array.
      r_major - the semi-major axis value in meters (modified).
      r_minor - the semi-minor axis value in meters (modified).
      radius - the radius value in meters (modified).
    • pack_angle

      public static double pack_angle(double angle)
      Packs an angle in degrees to DDDMMMSSS.SS format.
      Parameters:
      angle - the angle in degrees.
      Returns:
      the packed angle in DDDMMMSSS.SS format.
    • unpack_angle

      public static double unpack_angle(double angle)
      Unpacks an angle in DDDMMMSSS.SS format to degrees.
      Parameters:
      angle - the packed angle in DDDMMMSSS.SS format.
      Returns:
      the angle in degrees.