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_inverse‐
10 line - initialize a geodesic line
11 geod_setdistance geod_gensetdistance - set distance to refer‐
12 ence point
13 geod_position geod_genposition - a position on a geodesic line
14 geod_polygon_init - initialize a polygon
15 geod_addpoint geod_addedge - add to a polygon
16 geod_polygon_compute geod_polygon_testpoint geod_polygon_test‐
17 edge - compute properties of polygon
18 geod_polygon_clear - clear polygon
19 geod_polygonarea - the area of a polygon
20
22 #include <geodesic.h>
23 and link against the proj library.
24
26 This library is a port of the geodesic routines in the C++ li‐
27 brary, GeographicLib, to C. It solves the direct and inverse
28 geodesic problems on an ellipsoid of revolution. In addition,
29 the reduced length of a geodesic and the area between a geodes‐
30 ic and the equator can be computed. The results are accurate
31 to round off for |f| < 1/50, where f is the flattening. Note
32 that the geodesic routines measure angles (latitudes, longi‐
33 tudes, and azimuths) in degrees, unlike the rest of the proj
34 library, which uses radians. The documentation for this li‐
35 brary is included in geodesic.h. A formatted version of the
36 documentation is available at http://geographi‐
37 clib.sf.net/1.46/C
38
40 The following program reads in lines with the coordinates for
41 two points in decimal degrees (lat1, lon1, lat2, lon2) and
42 prints out azi1, azi2, s12 for the geodesic line between each
43 pair of points on the WGS84 ellipsoid. (N.B. azi2 is the for‐
44 ward azimuth at point 2.)
45
46 #include <stdio.h>
47 #include <geodesic.h>
48
49 int main() {
50 double a = 6378137, f = 1/298.257223563; /* WGS84 */
51 double lat1, lon1, azi1, lat2, lon2, azi2, s12;
52 struct geod_geodesic g;
53
54 geod_init(&g, a, f);
55 while (scanf("%lf %lf %lf %lf",
56 &lat1, &lon1, &lat2, &lon2) == 4) {
57 geod_inverse(&g, lat1, lon1, lat2, lon2,
58 &s12, &azi1, &azi2);
59 printf("%.8f %.8f %.3f\n", azi1, azi2, s12);
60 }
61 return 0;
62 }
63
65 libproj.a - library of projections and support procedures
66
68 Full online documentation for geodesic(3),
69 http://geographiclib.sf.net/1.46/C
70
71 geod(1)
72
73 GeographicLib, http://geographiclib.sf.net
74
75 The GeodesicExact class in GeographicLib solves the geodesic
76 problems in terms of elliptic integrals; the results are accu‐
77 rate for arbitrary f.
78
79 C. F. F. Karney, Algorithms for Geodesics,
80 J. Geodesy 87, 43-55 (2013);
81 DOI: http://dx.doi.org/10.1007/s00190-012-0578-z
82 http://geographiclib.sf.net/geod-addenda.html
83
84 A geodesic bibliography,
85 http://geographiclib.sf.net/geodesic-papers/biblio.html
86
87 The Wikipedia page, Geodesics on an ellipsoid,
88 https://en.wikipedia.org/wiki/Geodesics_on_an_ellipsoid
89
91 A list of known bugs can found at https://github.com/OS‐
92 Geo/proj.4/issues where new bug reports can be submitted too.
93
95 http://proj4.org/
96
97
98
99 2016/02/16 Rel. 4.9.3 GEODESIC(3)