1GEODESIC(3) Library Functions Manual GEODESIC(3)
2
3
4
6 geod_init - initialize an ellipsoid
7 geod_direct geod_gendirect - the direct geodesic problem
8 geod_inverse geod_geninverse - the inverse geodesic problem
9 geod_lineinit geod_directline geod_gendirectline geod_inverseline -
10 initialize a geodesic line
11 geod_setdistance geod_gensetdistance - set distance to reference point
12 geod_position geod_genposition - a position on a geodesic line
13 geod_polygon_init - initialize a polygon
14 geod_addpoint geod_addedge - add to a polygon
15 geod_polygon_compute geod_polygon_testpoint geod_polygon_testedge -
16 compute properties of polygon
17 geod_polygon_clear - clear polygon
18 geod_polygonarea - the area of a polygon
19
21 #include <geodesic.h>
22 and link against the proj library.
23
25 This library is a port of the geodesic routines in the C++ library, Ge‐
26 ographicLib, to C. It solves the direct and inverse geodesic problems
27 on an ellipsoid of revolution. In addition, the reduced length of a
28 geodesic and the area between a geodesic and the equator can be comput‐
29 ed. The results are accurate to round off for |f| < 1/50, where f is
30 the flattening. Note that the geodesic routines measure angles (lati‐
31 tudes, longitudes, and azimuths) in degrees, unlike the rest of the
32 proj library, which uses radians. The documentation for this library
33 is included in geodesic.h. A formatted version of the documentation is
34 available at https://geographiclib.sourceforge.io/1.49/C. Detailed
35 documentation of the interface is given at https://geographi‐
36 clib.sourceforge.io/1.49/C/geodesic_8h.html.
37
39 The following program reads in lines with the coordinates for two
40 points in decimal degrees (lat1, lon1, lat2, lon2) and prints out azi1,
41 azi2, s12 for the geodesic line between each pair of points on the
42 WGS84 ellipsoid. (N.B. azi2 is the forward azimuth at point 2.)
43
44 #include <stdio.h>
45 #include <geodesic.h>
46
47 int main() {
48 double a = 6378137, f = 1/298.257223563; /* WGS84 */
49 double lat1, lon1, azi1, lat2, lon2, azi2, s12;
50 struct geod_geodesic g;
51
52 geod_init(&g, a, f);
53 while (scanf("%lf %lf %lf %lf",
54 &lat1, &lon1, &lat2, &lon2) == 4) {
55 geod_inverse(&g, lat1, lon1, lat2, lon2,
56 &s12, &azi1, &azi2);
57 printf("%.8f %.8f %.3f\n", azi1, azi2, s12);
58 }
59 return 0;
60 }
61
63 libproj.a - library of projections and support procedures
64
66 Full online documentation for geodesic(3),
67 https://geographiclib.sourceforge.io/1.49/C
68 https://geographiclib.sourceforge.io/1.49/C/geodesic_8h.html
69
70 geod(1)
71
72 GeographicLib, https://geographiclib.sourceforge.io
73
74 The GeodesicExact class in GeographicLib solves the geodesic problems
75 in terms of elliptic integrals; the results are accurate for arbitrary
76 f.
77
78 C. F. F. Karney, Algorithms for Geodesics,
79 J. Geodesy 87, 43-55 (2013);
80 DOI: https://doi.org/10.1007/s00190-012-0578-z
81 https://geographiclib.sourceforge.io/geod-addenda.html
82
83 A geodesic bibliography,
84 https://geographiclib.sourceforge.io/geodesic-papers/biblio.html
85
86 The Wikipedia page, Geodesics on an ellipsoid,
87 https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid
88
90 A list of known bugs can found at https://github.com/OSGeo/proj.4/is‐
91 sues where new bug reports can be submitted too.
92
94 https://proj4.org/
95
96
97
98 2018/09/15 Rel. 5.2.0 GEODESIC(3)