Public Member Functions | Private Attributes | Static Private Attributes | List of all members
net.sf.geographiclib.Gnomonic Class Reference

Public Member Functions

double Flattening ()
 
GnomonicData Forward (double lat0, double lon0, double lat, double lon)
 
 Gnomonic (Geodesic earth)
 
double MajorRadius ()
 
GnomonicData Reverse (double lat0, double lon0, double x, double y)
 

Private Attributes

double _a
 
Geodesic _earth
 

Static Private Attributes

static final double eps_ = 0.01 * Math.sqrt(GeoMath.epsilon)
 
static final int numit_ = 10
 

Detailed Description

Gnomonic projection.

Note: Gnomonic.java has been ported to Java from its C++ equivalent Gnomonic.cpp, authored by C. F. F. Karney and licensed under MIT/X11 license. The following documentation is mostly the same as for its C++ equivalent, but has been adopted to apply to this Java implementation.

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 Gnomonic#Forward(double, double, double, double) performs the forward projection and Gnomonic#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 l. 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 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(T) − K(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 45°, when endpoints are a distance r away, and when their azimuths from the center are ± 45° or ± 135°. To 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:

Example of use:

// Example of using the Gnomonic.java class
import net.sf.geographiclib.Geodesic;
import net.sf.geographiclib.Gnomonic;
import net.sf.geographiclib.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);
    }
  }
}

Definition at line 133 of file Gnomonic.java.

Constructor & Destructor Documentation

◆ Gnomonic()

net.sf.geographiclib.Gnomonic.Gnomonic ( Geodesic  earth)
inline

Constructor for Gnomonic.

Parameters
earththe Geodesic object to use for geodesic calculations.

Definition at line 145 of file Gnomonic.java.

Member Function Documentation

◆ Flattening()

double net.sf.geographiclib.Gnomonic.Flattening ( )
inline
Returns
f the flattening of the ellipsoid. This is the value inherited from the Geodesic object used in the constructor.

Definition at line 279 of file Gnomonic.java.

◆ Forward()

GnomonicData net.sf.geographiclib.Gnomonic.Forward ( double  lat0,
double  lon0,
double  lat,
double  lon 
)
inline

Forward projection, from geographic to gnomonic.

Parameters
lat0latitude of center point of projection (degrees).
lon0longitude of center point of projection (degrees).
latlatitude of point (degrees).
lonlongitude of point (degrees).
Returns
GnomonicData object with the following fields: lat0, lon0, lat, lon, x, y, azi, rk.

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.

Definition at line 173 of file Gnomonic.java.

◆ MajorRadius()

double net.sf.geographiclib.Gnomonic.MajorRadius ( )
inline
Returns
a the equatorial radius of the ellipsoid (meters). This is the value inherited from the Geodesic object used in the constructor.

Definition at line 273 of file Gnomonic.java.

◆ Reverse()

GnomonicData net.sf.geographiclib.Gnomonic.Reverse ( double  lat0,
double  lon0,
double  x,
double  y 
)
inline

Reverse projection, from gnomonic to geographic.

Parameters
lat0latitude of center point of projection (degrees).
lon0longitude of center point of projection (degrees).
xeasting of point (meters).
ynorthing of point (meters).
Returns
GnomonicData object with the following fields: lat0, lon0, lat, lon, x, y, azi, rk.

lat0 should be in the range [−90°, 90°] and lon0 should be in the range [−540°, 540°). 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 all the output arguments. A call to Reverse followed by a call to Forward will return the original (x, y) (to roundoff).

Definition at line 217 of file Gnomonic.java.

Member Data Documentation

◆ _a

double net.sf.geographiclib.Gnomonic._a
private

Definition at line 137 of file Gnomonic.java.

◆ _earth

Geodesic net.sf.geographiclib.Gnomonic._earth
private

Definition at line 136 of file Gnomonic.java.

◆ eps_

final double net.sf.geographiclib.Gnomonic.eps_ = 0.01 * Math.sqrt(GeoMath.epsilon)
staticprivate

Definition at line 134 of file Gnomonic.java.

◆ numit_

final int net.sf.geographiclib.Gnomonic.numit_ = 10
staticprivate

Definition at line 135 of file Gnomonic.java.


The documentation for this class was generated from the following file:


gtsam
Author(s):
autogenerated on Fri Nov 1 2024 03:53:09