Skip to content

Commit

Permalink
Merge 77104aa into 91e7ff2
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Aug 18, 2016
2 parents 91e7ff2 + 77104aa commit d74f49a
Show file tree
Hide file tree
Showing 13 changed files with 1,935 additions and 1,937 deletions.
16 changes: 8 additions & 8 deletions man/man1/cs2cs.1
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
.nr LL 5.5i
.ad b
.hy 1
.TH CS2CS 1 "2000/03/21 Rel. 4.4"
.TH CS2CS 1 "2000/03/21 Rel. 4.4"
.SH NAME
cs2cs \- cartographic coordinate system filter
.SH SYNOPSIS
Expand All @@ -21,7 +21,7 @@ file[s]
.I Cs2cs
performs transformation between the source and destination cartographic
coordinate system on a set of input points. The coordinate system
transformation can include translation between projected and geographic
transformation can include translation between projected and geographic
coordinates as well as the application of datum shifts.
.PP
The following control parameters can appear in any order:
Expand Down Expand Up @@ -75,7 +75,7 @@ that can be selected with
.B +units
or
.B \-ld
list of datums that can be selected with
list of datums that can be selected with
.B +datum.
.TP
.BI \-r
Expand Down Expand Up @@ -121,13 +121,13 @@ and supplementary documentation for Release 4.
.PP
The \fIcs2cs\fR program requires two coordinate system definitions. The
first (or primary is defined based on all projection parameters not
appearing after the \fB+to\fR argument. All projection parameters
appearing after the \fB+to\fR argument. All projection parameters
appearing after the \fB+to\fR argument are considered the definition
of the second coordinate system. If there is no second coordinate system
defined, a geographic coordinate system based on the datum and ellipsoid of
the source coordinate system is assumed. Note that the source and destination
coordinate system can both be projections, both be geographic, or one of
each and may have the same or different datums.
each and may have the same or different datums.
.PP
Additional projection control parameters may be contained in two
auxiliary control files:
Expand Down Expand Up @@ -160,15 +160,15 @@ Input geographic data
(longitude and latitude) must be in DMS or decimal degrees format and input
cartesian data must be in units consistent with the ellipsoid
major axis or sphere radius units.
Output geographic coordinates will normally be in DMS format (use
.B \-f %.12f
Output geographic coordinates will normally be in DMS format (use
.B \-f %.12f
for decimal degrees with 12 decimal places), while
projected (cartesian) coordinates will be in linear (meter, feet) units.

.SH EXAMPLE
The following script
.RS 5
\f(CWcs2cs +proj=latlong +datum=NAD83
\f(CWcs2cs +proj=latlong +datum=NAD83
+to +proj=utm +zone=10 +datum=NAD27 \-r <<EOF
45d15'33.1" 111.5W
45d15.551666667N \-111d30
Expand Down
184 changes: 92 additions & 92 deletions src/PJ_eck1.c
Original file line number Diff line number Diff line change
@@ -1,92 +1,92 @@
#define PJ_LIB__
#include <projects.h>

PROJ_HEAD(eck1, "Eckert I") "\n\tPCyl., Sph.";
#define FC 0.92131773192356127802
#define RP 0.31830988618379067154


static XY s_forward (LP lp, PJ *P) { /* Spheroidal, forward */
XY xy = {0.0,0.0};
(void) P;

xy.x = FC * lp.lam * (1. - RP * fabs(lp.phi));
xy.y = FC * lp.phi;

return xy;
}


static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */
LP lp = {0.0,0.0};
(void) P;

lp.phi = xy.y / FC;
lp.lam = xy.x / (FC * (1. - RP * fabs(lp.phi)));

return (lp);
}


static void *freeup_new (PJ *P) { /* Destructor */
return pj_dealloc(P);
}


static void freeup (PJ *P) {
freeup_new (P);
return;
}


PJ *PROJECTION(eck1) {
P->es = 0.0;
P->inv = s_inverse;
P->fwd = s_forward;

return P;
}


#ifdef PJ_OMIT_SELFTEST
int pj_eck1_selftest (void) {return 0;}
#else

int pj_eck1_selftest (void) {
double tolerance_lp = 1e-10;
double tolerance_xy = 1e-7;

char s_args[] = {"+proj=eck1 +a=6400000 +lat_1=0.5 +lat_2=2"};

LP fwd_in[] = {
{ 2, 1},
{ 2,-1},
{-2, 1},
{-2,-1}
};
XY s_fwd_expect[] = {
{ 204680.88820295094, 102912.17842606473},
{ 204680.88820295094, -102912.17842606473},
{-204680.88820295094, 102912.17842606473},
{-204680.88820295094, -102912.17842606473},
};

XY inv_in[] = {
{ 200, 100},
{ 200,-100},
{-200, 100},
{-200,-100}
};

LP s_inv_expect[] = {
{ 0.0019434150820034624, 0.00097170229538813102},
{ 0.0019434150820034624, -0.00097170229538813102},
{-0.0019434150820034624, 0.00097170229538813102},
{-0.0019434150820034624, -0.00097170229538813102},
};

return pj_generic_selftest (0, s_args, tolerance_xy, tolerance_lp, 4, 4, fwd_in, 0, s_fwd_expect, inv_in, 0, s_inv_expect);
}


#endif
#define PJ_LIB__
#include <projects.h>

PROJ_HEAD(eck1, "Eckert I") "\n\tPCyl., Sph.";
#define FC 0.92131773192356127802
#define RP 0.31830988618379067154


static XY s_forward (LP lp, PJ *P) { /* Spheroidal, forward */
XY xy = {0.0,0.0};
(void) P;

xy.x = FC * lp.lam * (1. - RP * fabs(lp.phi));
xy.y = FC * lp.phi;

return xy;
}


static LP s_inverse (XY xy, PJ *P) { /* Spheroidal, inverse */
LP lp = {0.0,0.0};
(void) P;

lp.phi = xy.y / FC;
lp.lam = xy.x / (FC * (1. - RP * fabs(lp.phi)));

return (lp);
}


static void *freeup_new (PJ *P) { /* Destructor */
return pj_dealloc(P);
}


static void freeup (PJ *P) {
freeup_new (P);
return;
}


PJ *PROJECTION(eck1) {
P->es = 0.0;
P->inv = s_inverse;
P->fwd = s_forward;

return P;
}


#ifdef PJ_OMIT_SELFTEST
int pj_eck1_selftest (void) {return 0;}
#else

int pj_eck1_selftest (void) {
double tolerance_lp = 1e-10;
double tolerance_xy = 1e-7;

char s_args[] = {"+proj=eck1 +a=6400000 +lat_1=0.5 +lat_2=2"};

LP fwd_in[] = {
{ 2, 1},
{ 2,-1},
{-2, 1},
{-2,-1}
};
XY s_fwd_expect[] = {
{ 204680.88820295094, 102912.17842606473},
{ 204680.88820295094, -102912.17842606473},
{-204680.88820295094, 102912.17842606473},
{-204680.88820295094, -102912.17842606473},
};

XY inv_in[] = {
{ 200, 100},
{ 200,-100},
{-200, 100},
{-200,-100}
};

LP s_inv_expect[] = {
{ 0.0019434150820034624, 0.00097170229538813102},
{ 0.0019434150820034624, -0.00097170229538813102},
{-0.0019434150820034624, 0.00097170229538813102},
{-0.0019434150820034624, -0.00097170229538813102},
};

return pj_generic_selftest (0, s_args, tolerance_xy, tolerance_lp, 4, 4, fwd_in, 0, s_fwd_expect, inv_in, 0, s_inv_expect);
}


#endif
Expand Down

0 comments on commit d74f49a

Please sign in to comment.