Skip to content

Commit

Permalink
Major upgrade to geodesic support from Charles Karney (OSGeo#197).
Browse files Browse the repository at this point in the history
Syncs geodesic routines with GeographicLib.  Adds geodesic.3 man page. 
geod_* api exposed publically.  geodesic.h is installed.


git-svn-id: http://svn.osgeo.org/metacrs/proj/trunk@2333 4e78687f-474d-0410-85f9-8d5e500ac6b2
  • Loading branch information
warmerdam committed May 10, 2013
1 parent 1a41cfd commit a7bbac8
Show file tree
Hide file tree
Showing 12 changed files with 799 additions and 397 deletions.
2 changes: 1 addition & 1 deletion HOWTO-RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
- If any interfaces have been removed since the last public release, then
set age to 0.

4.5) Run "autgen.sh" (hopefully on the same machine it was last run on)
4.5) Run "autogen.sh" (hopefully on the same machine it was last run on)

5) Add a note to the ChangeLog that a new release is being issued, and what
the release number is.
Expand Down
26 changes: 18 additions & 8 deletions man/man1/geod.1
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.\" @(#)geod.1 - 1.1
.nr LL 5.5i
.\" @(#)geod.1
.nr LL 6.5i
.ad b
.hy 1
.TH GEOD 1 "2012/11/29 Rel. 4.8"
.TH GEOD 1 "2013/02/27 Rel. 4.8"
.SH NAME
geod \- direct geodesic computations
.br
Expand Down Expand Up @@ -171,7 +171,7 @@ and number of points to be determined.
.RE
.SH EXAMPLE
The following script determines the geodesic azimuths and distance in
U.S. stature miles from Boston, MA, to Portland, OR:
U.S. statute miles from Boston, MA, to Portland, OR:
.RS 5
\f(CWgeod +ellps=clrk66 <<EOF -I +units=us-mi
42d15'N 71d07'W 45d31'N 123d41'W
Expand Down Expand Up @@ -199,9 +199,19 @@ which gives:
Note: lack of precision in the distance value compromises
the precision of the Portland location.
.SH SEE ALSO
C. F. F. Karney,
.I "Algorithms for Geodesics," J. Geodesy (2012);
DOI: 10.1007/s00190-012-0578-z,
.B geodesic(3)
.br
The \fBGeodSolve\fR utility in \fBGeographicLib\fR,
http://geographiclib.sf.net. With the \fB-E\fR option, this solves the
geodesic problems in terms of elliptic integrals; the results are
accurate for arbitrary \fIf\fR.
.br
C. F. F. Karney, \fIAlgorithms for Geodesics\fR,
.br
J. Geodesy \fB87\fR, 43-55 (2013);
.br
DOI: http://dx.doi.org/10.1007/s00190-012-0578-z,
.br
http://geographiclib.sf.net/geod-addenda.html.
.SH HOME PAGE
http://www.remotesensing.org/proj
http://proj.osgeo.org
2 changes: 1 addition & 1 deletion man/man3/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
man_MANS = pj_init.3
man_MANS = pj_init.3 geodesic.3

EXTRA_DIST = $(man_MANS)
2 changes: 1 addition & 1 deletion man/man3/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
man_MANS = pj_init.3
man_MANS = pj_init.3 geodesic.3
EXTRA_DIST = $(man_MANS)
all: all-am

Expand Down
8 changes: 3 additions & 5 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ EXTRA_PROGRAMS = multistresstest
INCLUDES = -DPROJ_LIB=\"$(pkgdatadir)\" \
-DMUTEX_@MUTEX_SETTING@ @JNI_INCLUDE@

include_HEADERS = proj_api.h org_proj4_Projections.h org_proj4_PJ.h
include_HEADERS = proj_api.h org_proj4_Projections.h org_proj4_PJ.h geodesic.h

EXTRA_DIST = makefile.vc proj.def

proj_SOURCES = proj.c gen_cheb.c p_series.c
cs2cs_SOURCES = cs2cs.c gen_cheb.c p_series.c
nad2bin_SOURCES = nad2bin.c
geod_SOURCES = geod.c geod_set.c geod_interface.c geod_interface.h \
geodesic.c geodesic.h
geod_SOURCES = geod.c geod_set.c geod_interface.c geod_interface.h
multistresstest_SOURCES = multistresstest.c

proj_LDADD = libproj.la
Expand Down Expand Up @@ -64,8 +63,7 @@ libproj_la_SOURCES = \
nad_cvt.c nad_init.c nad_intr.c emess.c emess.h \
pj_apply_gridshift.c pj_datums.c pj_datum_set.c pj_transform.c \
geocent.c geocent.h pj_utils.c pj_gridinfo.c pj_gridlist.c \
jniproj.c pj_mutex.c pj_initcache.c pj_apply_vgridshift.c

jniproj.c pj_mutex.c pj_initcache.c pj_apply_vgridshift.c geodesic.c

install-exec-local:
rm -f $(DESTDIR)$(bindir)/invproj$(EXEEXT)
Expand Down
14 changes: 6 additions & 8 deletions src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ am_libproj_la_OBJECTS = PJ_aeqd.lo PJ_gnom.lo PJ_laea.lo \
pj_apply_gridshift.lo pj_datums.lo pj_datum_set.lo \
pj_transform.lo geocent.lo pj_utils.lo pj_gridinfo.lo \
pj_gridlist.lo jniproj.lo pj_mutex.lo pj_initcache.lo \
pj_apply_vgridshift.lo
pj_apply_vgridshift.lo geodesic.lo
libproj_la_OBJECTS = $(am_libproj_la_OBJECTS)
libproj_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
$(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
Expand All @@ -118,7 +118,7 @@ am_cs2cs_OBJECTS = cs2cs.$(OBJEXT) gen_cheb.$(OBJEXT) \
cs2cs_OBJECTS = $(am_cs2cs_OBJECTS)
cs2cs_DEPENDENCIES = libproj.la
am_geod_OBJECTS = geod.$(OBJEXT) geod_set.$(OBJEXT) \
geod_interface.$(OBJEXT) geodesic.$(OBJEXT)
geod_interface.$(OBJEXT)
geod_OBJECTS = $(am_geod_OBJECTS)
geod_DEPENDENCIES = libproj.la
am_multistresstest_OBJECTS = multistresstest.$(OBJEXT)
Expand Down Expand Up @@ -270,14 +270,12 @@ top_srcdir = @top_srcdir@
INCLUDES = -DPROJ_LIB=\"$(pkgdatadir)\" \
-DMUTEX_@MUTEX_SETTING@ @JNI_INCLUDE@

include_HEADERS = proj_api.h org_proj4_Projections.h org_proj4_PJ.h
include_HEADERS = proj_api.h org_proj4_Projections.h org_proj4_PJ.h geodesic.h
EXTRA_DIST = makefile.vc proj.def
proj_SOURCES = proj.c gen_cheb.c p_series.c
cs2cs_SOURCES = cs2cs.c gen_cheb.c p_series.c
nad2bin_SOURCES = nad2bin.c
geod_SOURCES = geod.c geod_set.c geod_interface.c geod_interface.h \
geodesic.c geodesic.h

geod_SOURCES = geod.c geod_set.c geod_interface.c geod_interface.h
multistresstest_SOURCES = multistresstest.c
proj_LDADD = libproj.la
cs2cs_LDADD = libproj.la
Expand Down Expand Up @@ -325,7 +323,7 @@ libproj_la_SOURCES = \
nad_cvt.c nad_init.c nad_intr.c emess.c emess.h \
pj_apply_gridshift.c pj_datums.c pj_datum_set.c pj_transform.c \
geocent.c geocent.h pj_utils.c pj_gridinfo.c pj_gridlist.c \
jniproj.c pj_mutex.c pj_initcache.c pj_apply_vgridshift.c
jniproj.c pj_mutex.c pj_initcache.c pj_apply_vgridshift.c geodesic.c

all: proj_config.h
$(MAKE) $(AM_MAKEFLAGS) all-am
Expand Down Expand Up @@ -583,7 +581,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geod.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geod_interface.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geod_set.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geodesic.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/geodesic.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/jniproj.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mk_cheby.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/multistresstest.Po@am__quote@
Expand Down
8 changes: 4 additions & 4 deletions src/geod_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@
#include "geod_interface.h"

void geod_ini(void) {
GeodesicInit(&GlobalGeodesic, geod_a, geod_f);
geod_init(&GlobalGeodesic, geod_a, geod_f);
}

void geod_pre(void) {
double
degree = PI/180,
lat1 = phi1 / degree, lon1 = lam1 /degree, azi1 = al12 / degree;
GeodesicLineInit(&GlobalGeodesicLine, &GlobalGeodesic,
geod_lineinit(&GlobalGeodesicLine, &GlobalGeodesic,
lat1, lon1, azi1, 0U);
}

void geod_for(void) {
double degree = PI/180, s12 = geod_S, lat2, lon2, azi2;
Position(&GlobalGeodesicLine, s12, &lat2, &lon2, &azi2);
geod_position(&GlobalGeodesicLine, s12, &lat2, &lon2, &azi2);
azi2 += azi2 >= 0 ? -180 : 180; /* Compute back azimuth */
phi2 = lat2 * degree;
lam2 = lon2 * degree;
Expand All @@ -28,7 +28,7 @@ void geod_inv(void) {
lat1 = phi1 / degree, lon1 = lam1 / degree,
lat2 = phi2 / degree, lon2 = lam2 / degree,
azi1, azi2, s12;
Inverse(&GlobalGeodesic, lat1, lon1, lat2, lon2, &s12, &azi1, &azi2);
geod_inverse(&GlobalGeodesic, lat1, lon1, lat2, lon2, &s12, &azi1, &azi2);
azi2 += azi2 >= 0 ? -180 : 180; /* Compute back azimuth */
al12 = azi1 * degree; al21 = azi2 * degree; geod_S = s12;
}
4 changes: 2 additions & 2 deletions src/geod_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ GEOD_EXTERN struct geodesic {
# define al21 GEODESIC.ALPHA21
# define geod_S GEODESIC.DIST

GEOD_EXTERN struct Geodesic GlobalGeodesic;
GEOD_EXTERN struct GeodesicLine GlobalGeodesicLine;
GEOD_EXTERN struct geod_geodesic GlobalGeodesic;
GEOD_EXTERN struct geod_geodesicline GlobalGeodesicLine;
GEOD_EXTERN int n_alpha, n_S;
GEOD_EXTERN double to_meter, fr_meter, del_alpha;

Expand Down
Loading

0 comments on commit a7bbac8

Please sign in to comment.