| 1 |
/******************************************************************************* |
| 2 |
NAME WAGNER VII |
| 3 |
|
| 4 |
PURPOSE: Transforms input longitude and latitude to Easting and |
| 5 |
Northing for the Wagner VII projection. The |
| 6 |
longitude and latitude must be in radians. The Easting |
| 7 |
and Northing values will be returned in meters. |
| 8 |
|
| 9 |
PROGRAMMER DATE |
| 10 |
---------- ---- |
| 11 |
D. Steinwand, EROS May, 1991 |
| 12 |
|
| 13 |
This function was implemented with formulas supplied by John P. Snyder. |
| 14 |
|
| 15 |
ALGORITHM REFERENCES |
| 16 |
|
| 17 |
1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", |
| 18 |
U.S. Geological Survey Professional Paper 1453 , United State Government |
| 19 |
Printing Office, Washington D.C., 1989. |
| 20 |
|
| 21 |
2. Snyder, John P., Personal correspondence, January 1991. |
| 22 |
*******************************************************************************/ |
| 23 |
#include <stdio.h> |
| 24 |
#include "cproj.h" |
| 25 |
|
| 26 |
/* Variables common to all subroutines in this code file |
| 27 |
-----------------------------------------------------*/ |
| 28 |
static double lon_center; /* Center longitude (projection center) */ |
| 29 |
static double R; /* Radius of the earth (sphere) */ |
| 30 |
static double false_easting; /* x offset */ |
| 31 |
static double false_northing; /* y offset */ |
| 32 |
|
| 33 |
/* Initialize the Wagner VII projection |
| 34 |
------------------------------------*/ |
| 35 |
int wviiforint( |
| 36 |
double r, /* (I) Radius of the earth (sphere) */ |
| 37 |
double center_long, /* (I) Center longitude */ |
| 38 |
double false_east, /* x offset */ |
| 39 |
double false_north) /* y offset */ |
| 40 |
{ |
| 41 |
/* Place parameters in static storage for common use |
| 42 |
-------------------------------------------------*/ |
| 43 |
R = r; |
| 44 |
lon_center = center_long; |
| 45 |
false_easting = false_east; |
| 46 |
false_northing = false_north; |
| 47 |
|
| 48 |
/* Report parameters to the user |
| 49 |
-----------------------------*/ |
| 50 |
ptitle("WAGNER VII"); |
| 51 |
radius(r); |
| 52 |
cenlon(center_long); |
| 53 |
offsetp(false_easting,false_northing); |
| 54 |
return(OK); |
| 55 |
} |
| 56 |
|
| 57 |
/* Wagner VII forward equations--mapping lat,long to x,y |
| 58 |
-----------------------------------------------------*/ |
| 59 |
int wviifor( |
| 60 |
double lon, /* (I) Longitude */ |
| 61 |
double lat, /* (I) Latitude */ |
| 62 |
double *x, /* (O) X projection coordinate */ |
| 63 |
double *y) /* (O) Y projection coordinate */ |
| 64 |
{ |
| 65 |
double delta_lon; /* Delta longitude (Given longitude - center */ |
| 66 |
double sin_lon, cos_lon; |
| 67 |
double s, c0, c1; |
| 68 |
|
| 69 |
/* Forward equations |
| 70 |
-----------------*/ |
| 71 |
delta_lon = adjust_lon(lon - lon_center); |
| 72 |
tsincos((delta_lon/3.0), &sin_lon, &cos_lon); |
| 73 |
s = 0.90631 * sin(lat); |
| 74 |
c0 = sqrt(1-s*s); |
| 75 |
c1 = sqrt(2.0 / (1.0 + c0 * cos_lon)); |
| 76 |
*x = 2.66723 * R * c0 * c1 * sin_lon + false_easting; |
| 77 |
*y = 1.24104 * R * s * c1 + false_northing; |
| 78 |
return(OK); |
| 79 |
} |