| 1 |
/******************************************************************************* |
| 2 |
NAME INTERRUPTED MOLLWEIDE |
| 3 |
|
| 4 |
PURPOSE: Transforms input Easting and Northing to longitude and |
| 5 |
latitude for the Interrupted Mollweide projection. The |
| 6 |
Easting and Northing must be in meters. The longitude |
| 7 |
and latitude values will be returned in radians. |
| 8 |
|
| 9 |
PROGRAMMER DATE REASON |
| 10 |
---------- ---- ------ |
| 11 |
D. Steinwand, EROS June, 1991 Initial Development |
| 12 |
S. Nelson, EDC June, 1993 Changed precision for values to |
| 13 |
determine regions and if coordinates |
| 14 |
are in the break, and for the values |
| 15 |
in the conversion algorithm. |
| 16 |
|
| 17 |
ALGORITHM REFERENCES |
| 18 |
|
| 19 |
1. Snyder, John P. and Voxland, Philip M., "An Album of Map Projections", |
| 20 |
U.S. Geological Survey Professional Paper 1453 , United State Government |
| 21 |
Printing Office, Washington D.C., 1989. |
| 22 |
|
| 23 |
2. Snyder, John P., "Map Projections--A Working Manual", U.S. Geological |
| 24 |
Survey Professional Paper 1395 (Supersedes USGS Bulletin 1532), United |
| 25 |
State Government Printing Office, Washington D.C., 1987. |
| 26 |
*******************************************************************************/ |
| 27 |
#include <stdio.h> |
| 28 |
#include "cproj.h" |
| 29 |
|
| 30 |
/* Variables common to all subroutines in this code file |
| 31 |
-----------------------------------------------------*/ |
| 32 |
static double R; /* Radius of the earth (sphere) */ |
| 33 |
static double lon_center[6]; /* Central meridians, one for each region */ |
| 34 |
static double feast[6]; /* False easting, one for each region */ |
| 35 |
|
| 36 |
/* Initialize the Interrupted Mollweide projection |
| 37 |
--------------------------------------------*/ |
| 38 |
int imolwinvint( |
| 39 |
double r) /* (I) Radius of the earth (sphere) */ |
| 40 |
{ |
| 41 |
/* Place parameters in static storage for common use |
| 42 |
-------------------------------------------------*/ |
| 43 |
R = r; |
| 44 |
|
| 45 |
/* Initialize central meridians for each of the 6 regions |
| 46 |
------------------------------------------------------*/ |
| 47 |
lon_center[0] = 1.0471975512; /* 60.0 degrees */ |
| 48 |
lon_center[1] = -2.96705972839; /* -170.0 degrees */ |
| 49 |
lon_center[2] = -0.523598776; /* -30.0 degrees */ |
| 50 |
lon_center[3] = 1.57079632679; /* 90.0 degrees */ |
| 51 |
lon_center[4] = -2.44346095279; /* -140.0 degrees */ |
| 52 |
lon_center[5] = -0.34906585; /* -20.0 degrees */ |
| 53 |
|
| 54 |
/* Initialize false eastings for each of the 6 regions |
| 55 |
---------------------------------------------------*/ |
| 56 |
feast[0] = R * -2.19988776387; |
| 57 |
feast[1] = R * -0.15713484; |
| 58 |
feast[2] = R * 2.04275292359; |
| 59 |
feast[3] = R * -1.72848324304; |
| 60 |
feast[4] = R * 0.31426968; |
| 61 |
feast[5] = R * 2.19988776387; |
| 62 |
|
| 63 |
/* Report parameters to the user |
| 64 |
-----------------------------*/ |
| 65 |
ptitle("INTERRUPTED MOLLWEIDE EQUAL-AREA"); |
| 66 |
radius(r); |
| 67 |
return(OK); |
| 68 |
} |
| 69 |
|
| 70 |
int imolwinv( |
| 71 |
double x, /* (I) X projection coordinate */ |
| 72 |
double y, /* (I) Y projection coordinate */ |
| 73 |
double *lon, /* (O) Longitude */ |
| 74 |
double *lat) /* (O) Latitude */ |
| 75 |
{ |
| 76 |
double theta; |
| 77 |
long region; |
| 78 |
|
| 79 |
/* Inverse equations |
| 80 |
-----------------*/ |
| 81 |
if (y >= 0.0) |
| 82 |
{ |
| 83 |
if (x <= R * -1.41421356248) region = 0; |
| 84 |
else if (x <= R * 0.942809042) region = 1; |
| 85 |
else region = 2; |
| 86 |
} |
| 87 |
else |
| 88 |
{ |
| 89 |
if (x <= R * -0.942809042) region = 3; |
| 90 |
else if (x <= R * 1.41421356248) region = 4; |
| 91 |
else region = 5; |
| 92 |
} |
| 93 |
x = x - feast[region]; |
| 94 |
|
| 95 |
theta = asin(y / (1.4142135623731 * R)); |
| 96 |
*lon = adjust_lon(lon_center[region] + (x / (0.900316316158*R * cos(theta)))); |
| 97 |
*lat = asin((2.0 * theta + sin(2.0 * theta)) / PI); |
| 98 |
|
| 99 |
/* Are we in a interrupted area? If so, return status code of IN_BREAK. |
| 100 |
---------------------------------------------------------------------*/ |
| 101 |
if (region == 0 && (*lon < 0.34906585 || *lon > 1.91986217719))return(IN_BREAK); |
| 102 |
if (region == 1 && ((*lon < 1.91986217719 && *lon > 0.34906585) || |
| 103 |
(*lon > -1.74532925199 && *lon < 0.34906585))) return(IN_BREAK); |
| 104 |
if (region == 2 && (*lon < -1.745329252 || *lon > 0.34906585)) return(IN_BREAK); |
| 105 |
if (region == 3 && (*lon < 0.34906585 || *lon > 2.44346095279))return(IN_BREAK); |
| 106 |
if (region == 4 && ((*lon < 2.44346095279 && *lon > 0.34906585) || |
| 107 |
(*lon > -1.2217304764 && *lon < 0.34906585))) return(IN_BREAK); |
| 108 |
if (region == 5 && (*lon < -1.2217304764 || *lon> 0.34906585))return(IN_BREAK); |
| 109 |
return(OK); |
| 110 |
} |
| 111 |
|