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 |
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.
|
inline |
Constructor for Gnomonic.
earth | the Geodesic object to use for geodesic calculations. |
Definition at line 145 of file Gnomonic.java.
|
inline |
Definition at line 279 of file Gnomonic.java.
|
inline |
Forward projection, from geographic to gnomonic.
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). |
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.
|
inline |
Definition at line 273 of file Gnomonic.java.
|
inline |
Reverse projection, from gnomonic to geographic.
lat0 | latitude of center point of projection (degrees). |
lon0 | longitude of center point of projection (degrees). |
x | easting of point (meters). |
y | northing of point (meters). |
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.
|
private |
Definition at line 137 of file Gnomonic.java.
|
private |
Definition at line 136 of file Gnomonic.java.
|
staticprivate |
Definition at line 134 of file Gnomonic.java.
|
staticprivate |
Definition at line 135 of file Gnomonic.java.