Due to the lapse in federal government funding, NASA is not updating this website. We sincerely regret this inconvenience.
NASA Logo
Ocean Color Science Software

ocssw V2022
wivinv.c
Go to the documentation of this file.
1 /*******************************************************************************
2 NAME WAGNER IV
3 
4 PURPOSE: Transforms input Easting and Northing to longitude and
5  latitude for the Wagner IV projection. The
6  Easting and Northing must be in meters. The longitude
7  and latitude values will be returned in radians.
8 
9 ALGORITHM REFERENCES
10 
11 1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections",
12  U.S. Geological Survey Professional Paper 1453 , United State Government
13  Printing Office, Washington D.C., 1989.
14 
15 2. Snyder, John P., Personal correspondence, January 1991.
16 *******************************************************************************/
17 #include "oli_cproj.h"
18 #include "oli_local.h"
19 
20 /* Variables common to all subroutines in this code file
21  -----------------------------------------------------*/
22 static double lon_center; /* Center longitude (projection center) */
23 static double R; /* Radius of the earth (sphere) */
24 static double false_easting; /* x offset */
25 static double false_northing; /* y offset */
26 
27 /* Initialize the Wagner IV projection
28  ------------------------------------*/
29 long wivinvint
30 (
31  double r, /* (I) Radius of the earth (sphere) */
32  double center_long, /* (I) Center longitude */
33  double false_east, /* x offset */
34  double false_north /* y offset */
35 )
36 {
37 /* Place parameters in static storage for common use
38  -------------------------------------------------*/
39 R = r;
40 lon_center = center_long;
41 false_easting = false_east;
42 false_northing = false_north;
43 
44 /* Report parameters to the user
45  -----------------------------*/
46 gctp_print_title("WAGNER IV");
48 gctp_print_cenlon(center_long);
49 gctp_print_offsetp(false_east,false_north);
50 return(OK);
51 }
52 
53 /* Wagner IV inverse equations--mapping x,y to lat,long
54  ----------------------------------------------------*/
55 long wivinv
56 (
57  double x, /* (I) X projection coordinate */
58  double y, /* (I) Y projection coordinate */
59  double *lon, /* (O) Longitude */
60  double *lat /* (O) Latitude */
61 )
62 {
63 double theta;
64 
65 /* Inverse equations
66  -----------------*/
67 x -= false_easting;
68 y -= false_northing;
69 theta = asin(y / (1.56548 * R));
70 *lon = adjust_lon(lon_center + (x / (0.86310 * R * cos(theta))));
71 *lat = asin((2.0 * theta + sin(2.0 * theta)) / 2.9604205062);
72 return(OK);
73 }
74 
int r
Definition: decode_rs.h:73
void gctp_print_title(const char *proj_name)
Definition: gctp_report.c:14
long wivinv(double x, double y, double *lon, double *lat)
Definition: wivinv.c:56
void gctp_print_cenlon(double A)
Definition: gctp_report.c:40
double adjust_lon(double x)
Definition: proj_cproj.c:349
double false_easting
Definition: tm.c:54
void gctp_print_offsetp(double A, double B)
Definition: gctp_report.c:91
double false_northing
Definition: tm.c:53
#define OK
Definition: ancil.h:30
long wivinvint(double r, double center_long, double false_east, double false_north)
Definition: wivinv.c:30
double lon_center
Definition: tm.c:51
void gctp_print_radius(double radius)
Definition: gctp_report.c:22
#define R
Definition: make_L3_v1.1.c:96