Class Gnomonic

java.lang.Object
com.irurueta.navigation.geodesic.Gnomonic

public class Gnomonic extends Object
Gnomonic projection. Gnomonic projection centered at an arbitrary position C on the ellipsoid. This projection is derived in Section 8 of The gnomonic projection of a point P on the ellipsoid is defined as follows: compute the geodesic line from C to P; compute the reduced length m12, geodesic scale M12, and ρ = m12/M12; finally, this gives the coordinates x and y of P in gnomonic projection with x = ρ sin azi1; y = ρ cos azi1, where azi1 is the azimuth of the geodesic at C. The method forward(double, double, double, double) performs the forward projection and reverse(double, double, double, double) is the inverse of the projection. The methods also return the azimuth azi of the geodesic at P and reciprocal scale rk in the azimuthal direction. The scale in the radial direction is 1/rk2. For a sphere, ρ reduces to a tan (s12/a), where s12 is the length of the geodesic from C to P, and the gnomonic projection has the property that all geodesics appear as straight lines. For an ellipsoid, this property holds only for geodesics interesting the centers. However, geodesic segments close to the center are approximately straight. Consider a geodesic segment of length 1. Let T be the point on the geodesic (extended if necessary) closest to C, the center of the projection, and t, be the distance CT. To the lowest order, the maximum deviation (as a true distance) of the corresponding gnomonic line segment (i.e., with the same end points) from the geodesic is (K(TK(C)) l2 t / 32. where K is the Gaussian curvature. This result applies for any surface. For an ellipsoid of revolution, consider all geodesics whose end points are within a distance r of C. For a given r, the deviation is maximum when the latitude of C is 46°, when endpoints are a distance r away, and when their azimuths from the center are ± 45° or ± 135°. To the lowest order in r and the flattening f, the deviation is f (r/2a)3 r. CAUTION: The definition of this projection for a sphere is standard. However, there is no standard for how it should be extended to an ellipsoid. The choices are:
  • Declare that the projection is undefined for an ellipsoid.
  • Project to a tangent plane from the center of the ellipsoid. This causes great ellipses to appear as straight lines in the projection; i.e., it generalizes the spherical great circle to a great ellipse. This was proposed independently by Bowring and Williams in 1997.
  • Project to the conformal sphere with the constant of integration chosen so that the values of the latitude match for the center point and perform a central projection onto the plane tangent to the conformal sphere at the center point. This causes normal section through the center point to appear as straight lines in the projection; i.e., it generalizes the spherical great circle to a normal section. This was proposed by I. G. Letoval'tsev, Generalization of the gnomonic projection for a spheroid and the principal geodetic problems involved in the alignment of surface routes, Geodesy and Aerophotography(5), 271–275 (1963)
  • The projection given here. This causes geodesics close to the center point to appear as straight lines in the projection; i.e., it generalizes the spherical great circle to a geodesic.
Example of use:
 // Example of using the Gnomonic.java class
 import com.irurueta.navigation.geodesic.Geodesic;
 import com.irurueta.navigation.geodesic.Gnomonic;
 import com.irurueta.navigation.geodesic.GnomonicData;
 public class ExampleGnomonic {
   public static void main(String[] args) {
     Geodesic geod = Geodesic.WGS84;
     double lat0 = 48 + 50 / 60.0, lon0 = 2 + 20 / 60.0; // Paris
     Gnomonic gnom = new Gnomonic(geod);
     {
       // Sample forward calculation
       double lat = 50.9, lon = 1.8; // Calais
       GnomonicData proj = gnom.Forward(lat0, lon0, lat, lon);
       System.out.println(proj.x + " " + proj.y);
     }
     {
       // Sample reverse calculation
       double x = -38e3, y = 230e3;
       GnomonicData proj = gnom.Reverse(lat0, lon0, x, y);
       System.out.println(proj.lat + " " + proj.lon);
     }
   }
 }
 
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final double
    Major equatorial Earth radius.
    private final Geodesic
    Earth geodesic.
    private static final double
     
    private final double
    Earth flattening.
    private static final int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Constructor for Gnomonic.
  • Method Summary

    Modifier and Type
    Method
    Description
    forward(double lat0, double lon0, double lat, double lon)
    Forward projection, from geographic to gnomonic.
    double
    Gets the flattening of the ellipsoid.
    double
    Gets the equatorial radius of the ellipsoid (meters).
    reverse(double lat0, double lon0, double x, double y)
    Reverse projection, from gnomonic to geographic.

    Methods inherited from class java.lang.Object

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

    • EPS

      private static final double EPS
    • NUMIT

      private static final int NUMIT
      See Also:
    • earth

      private final Geodesic earth
      Earth geodesic.
    • a

      private final double a
      Major equatorial Earth radius.
    • f

      private final double f
      Earth flattening.
  • Constructor Details

    • Gnomonic

      public Gnomonic(Geodesic earth)
      Constructor for Gnomonic.
      Parameters:
      earth - the Geodesic object to use for geodesic calculations.
  • Method Details

    • forward

      public GnomonicData forward(double lat0, double lon0, double lat, double lon)
      Forward projection, from geographic to gnomonic. lat0 and lat should be in the range [−90°, 90°] and lon0 and lon should be in the range [−540°, 540°). The scale of the projection is 1/rk2 in the "radial" direction, azi clockwise from true north, and is 1/rk in the direction perpendicular to this. If the point lies "over the horizon", i.e., if rk ≤ 0, then NaNs are returned for x and y (the correct values are returned for azi and rk). A call to forward followed by a call to reverse will return the original (lat, lon) (to within roundoff) provided the point in not over the horizon.
      Parameters:
      lat0 - latitude of center point of projection (degrees).
      lon0 - longitude of center point of projection (degrees).
      lat - latitude of point (degrees).
      lon - longitude of point (degrees).
      Returns:
      GnomonicData object with the following fields: lat0, lon0, lat, lon, x, y, azi, rk.
    • reverse

      public GnomonicData reverse(double lat0, double lon0, double x, double y)
      Reverse projection, from gnomonic to geographic. lat will be in the range [−90°, 90°] and lon will be in the range (−180°, 180°]. The scale of the projection is 1/rk2 in the "radial" direction, azi clockwise from true north, and is 1/rk in the direction perpendicular to this. Even though all inputs should return a valid lat and lon, it's possible that the procedure fails to converge for very large x or y; in this case NaNs are returned for very large x or y; in this case NaNs are returned for all the output arguments. A call to reverse followed by a call to forward will return the original (x, y) (to round-off).
      Parameters:
      lat0 - latitude of center point of projection (degrees). lat0 should be in the range [−90°, 90°]
      lon0 - longitude of center point of projection (degrees). lon0 should be in the range [−540°, 540°).
      x - easting of point (meters).
      y - northing of point (meters).
      Returns:
      GnomonicData object with the following fields: lat0, lon0, lat, lon, x, y, azi, rk.
    • getMajorRadius

      public double getMajorRadius()
      Gets the equatorial radius of the ellipsoid (meters). This is the value inherited from the Geodesic object used in the constructor.
      Returns:
      a the equatorial radius of the ellipsoid (meters).
    • getFlattening

      public double getFlattening()
      Gets the flattening of the ellipsoid.
      Returns:
      f the flattening of the ellipsoid. This is the value inherited from the Geodesic object used in the constructor.