Cartography-Projection-GCTP
view release on metacpan or search on metacpan
gctpc/robfor.c view on Meta::CPAN
double dlon;
double p2;
long ip1;
/* Forward equations
-----------------*/
dlon = adjust_lon(lon - lon_center);
p2 = fabs(lat / 5.0 / .01745329252);
ip1 = (long) (p2 - EPSLN);
/* Stirling's interpolation formula (using 2nd Diff.)
---------------------------------------------------*/
p2 -= (double) ip1;
*x = R * (xlr[ip1 + 2] + p2 * (xlr[ip1 + 3] - xlr[ip1 + 1]) / 2.0 +
p2 * p2 * (xlr[ip1 + 3] - 2.0 * xlr[ip1 + 2] + xlr[ip1 + 1])/2.0) *
dlon + false_easting;
if (lat >= 0)
*y = R * (pr[ip1 + 2] + p2 * (pr[ip1 + 3] - pr[ip1 +1]) / 2.0 + p2 * p2 *
(pr[ip1 + 3] - 2.0 * pr[ip1 + 2] + pr[ip1 + 1]) / 2.0) * PI / 2.0 +
false_northing;
gctpc/robinv.c view on Meta::CPAN
x -= false_easting;
y -= false_northing;
yy = 2.0 * y / PI / R;
phid = yy * 90.0;
p2 = fabs(phid / 5.0);
ip1 = (long) (p2 - EPSLN);
if (ip1 == 0)
ip1 = 1;
/* Stirling's interpolation formula as used in forward transformation is
reversed for first estimation of LAT. from rectangular coordinates. LAT.
is then adjusted by iteration until use of forward series provides correct
value of Y within tolerance.
---------------------------------------------------------------------------*/
for (i = 0;;)
{
u = pr[ip1 + 3] - pr[ip1 + 1];
v = pr[ip1 + 3] - 2.0 * pr[ip1 + 2] + pr[ip1 + 1];
t = 2.0 * (fabs(yy) - pr[ip1 + 2]) / u;
c = v / u;
gctpc/robinv.c view on Meta::CPAN
if (ip1 < 0)
{
p_error("Too many iterations in inverse","robinv-conv");
return(234);
}
}
}
*lat = phid * .01745329252;
/* calculate LONG. using final LAT. with transposed forward Stirling's
interpolation formula.
---------------------------------------------------------------------*/
*lon = lon_center + x / R / (xlr[ip1 + 2] + p2 * (xlr[ip1 + 3] - xlr[ip1 + 1])
/ 2.0 + p2 * p2 * (xlr[ip1 + 3] - 2.0 * xlr[ip1 + 2] +
xlr[ip1 + 1]) / 2.0);
*lon = adjust_lon(*lon);
return(OK);
}
gctpc/wivfor.c view on Meta::CPAN
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Wagner IV projection. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
PROGRAMMER DATE REASON
---------- ---- ------
D. Steinwand, EROS May, 1991
S. Nelson, EROS Feb, 1995 Changed perror to p_error.
This function was implemented with formulas supplied by John P. Snyder.
ALGORITHM REFERENCES
1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
Printing Office, Washington D.C., 1989.
2. Snyder, John P., Personal correspondence, January 1991.
*******************************************************************************/
#include "cproj.h"
gctpc/wivinv.c view on Meta::CPAN
PURPOSE: Transforms input Easting and Northing to longitude and
latitude for the Wagner IV projection. The
Easting and Northing must be in meters. The longitude
and latitude values will be returned in radians.
PROGRAMMER DATE
---------- ----
D. Steinwand, EROS May, 1991
This function was implemented with formulas supplied by John P. Snyder.
ALGORITHM REFERENCES
1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
Printing Office, Washington D.C., 1989.
2. Snyder, John P., Personal correspondence, January 1991.
*******************************************************************************/
#include "cproj.h"
gctpc/wviifor.c view on Meta::CPAN
PURPOSE: Transforms input longitude and latitude to Easting and
Northing for the Wagner VII projection. The
longitude and latitude must be in radians. The Easting
and Northing values will be returned in meters.
PROGRAMMER DATE
---------- ----
D. Steinwand, EROS May, 1991
This function was implemented with formulas supplied by John P. Snyder.
ALGORITHM REFERENCES
1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
Printing Office, Washington D.C., 1989.
2. Snyder, John P., Personal correspondence, January 1991.
*******************************************************************************/
#include "cproj.h"
gctpc/wviiinv.c view on Meta::CPAN
Easting and Northing must be in meters. The longitude
and latitude values will be returned in radians.
PROGRAMMER DATE
---------- ----
D. Steinwand, EROS May, 1991
S. Nelson, EROS Dec, 1993 Added function call to "asinz" to
fix errors at 90 and -90 deg lat.
This replaced calls to "asin".
This function was implemented with formulas supplied by John P. Snyder.
ALGORITHM REFERENCES
1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
U.S. Geological Survey Professional Paper 1453 , United State Government
Printing Office, Washington D.C., 1989.
2. Snyder, John P., Personal correspondence, January 1991.
*******************************************************************************/
#include "cproj.h"
( run in 0.278 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )