4
/***************************************************************************/
5
/* RSC IDENTIFIER: ALBERS
9
* This component provides conversions between Geodetic coordinates
10
* (latitude and longitude in radians) and Albers Equal Area Conic
11
* projection coordinates (easting and northing in meters) defined
12
* by two standard parallels.
16
* This component checks parameters for valid values. If an invalid value
17
* is found the error code is combined with the current error code using
18
* the bitwise or. This combining allows multiple error codes to be
19
* returned. The possible error codes are:
21
* ALBERS_NO_ERROR : No errors occurred in function
22
* ALBERS_LAT_ERROR : Latitude outside of valid range
24
* ALBERS_LON_ERROR : Longitude outside of valid range
25
* (-180 to 360 degrees)
26
* ALBERS_EASTING_ERROR : Easting outside of valid range
27
* (depends on ellipsoid and projection
29
* ALBERS_NORTHING_ERROR : Northing outside of valid range
30
* (depends on ellipsoid and projection
32
* ALBERS_FIRST_STDP_ERROR : First standard parallel outside of valid
33
* range (-90 to 90 degrees)
34
* ALBERS_SECOND_STDP_ERROR : Second standard parallel outside of valid
35
* range (-90 to 90 degrees)
36
* ALBERS_ORIGIN_LAT_ERROR : Origin latitude outside of valid range
38
* ALBERS_CENT_MER_ERROR : Central meridian outside of valid range
39
* (-180 to 360 degrees)
40
* ALBERS_A_ERROR : Semi-major axis less than or equal to zero
41
* ALBERS_INV_F_ERROR : Inverse flattening outside of valid range
43
* ALBERS_HEMISPHERE_ERROR : Standard parallels cannot be opposite
45
* ALBERS_FIRST_SECOND_ERROR : The 1st & 2nd standard parallels cannot
51
* ALBERS is intended for reuse by any application that performs an Albers
52
* Equal Area Conic projection or its inverse.
56
* Further information on ALBERS can be found in the Reuse Manual.
58
* ALBERS originated from: U.S. Army Topographic Engineering Center
59
* Geospatial Information Division
61
* Alexandria, VA 22310-3864
65
* None apply to this component.
69
* ALBERS has no restrictions.
73
* ALBERS was tested and certified in the following environments:
75
* 1. Solaris 2.5 with GCC, version 2.8.1
76
* 2. MSDOS with MS Visual C++, version 6
82
* 07-09-99 Original Code
88
/***************************************************************************/
93
#define ALBERS_NO_ERROR 0x0000
94
#define ALBERS_LAT_ERROR 0x0001
95
#define ALBERS_LON_ERROR 0x0002
96
#define ALBERS_EASTING_ERROR 0x0004
97
#define ALBERS_NORTHING_ERROR 0x0008
98
#define ALBERS_ORIGIN_LAT_ERROR 0x0010
99
#define ALBERS_CENT_MER_ERROR 0x0020
100
#define ALBERS_A_ERROR 0x0040
101
#define ALBERS_INV_F_ERROR 0x0080
102
#define ALBERS_FIRST_STDP_ERROR 0x0100
103
#define ALBERS_SECOND_STDP_ERROR 0x0200
104
#define ALBERS_FIRST_SECOND_ERROR 0x0400
105
#define ALBERS_HEMISPHERE_ERROR 0x0800
107
/***************************************************************************/
109
* FUNCTION PROTOTYPES
113
/* ensure proper linkage to c++ programs */
122
long Set_Albers_Parameters(double a,
124
double Origin_Latitude,
125
double Central_Meridian,
126
double Std_Parallel_1,
127
double Std_Parallel_2,
128
double False_Easting,
129
double False_Northing);
131
/* The function Set_Albers_Parameters receives the ellipsoid parameters and
132
* projection parameters as inputs, and sets the corresponding state
133
* variables. If any errors occur, the error code(s) are returned by the function,
134
* otherwise ALBERS_NO_ERROR is returned.
136
* a : Semi-major axis of ellipsoid, in meters (input)
137
* f : Flattening of ellipsoid (input)
138
* Origin_Latitude : Latitude in radians at which the (input)
139
* point scale factor is 1.0
140
* Central_Meridian : Longitude in radians at the center of (input)
141
* the projection (central meridian)
142
* Std_Parallel_1 : First standard parallel (input)
143
* Std_Parallel_2 : Second standard parallel (input)
144
* False_Easting : A coordinate value in meters assigned to the
145
* central meridian of the projection. (input)
146
* False_Northing : A coordinate value in meters assigned to the
147
* origin latitude of the projection (input)
151
void Get_Albers_Parameters(double *a,
153
double *Origin_Latitude,
154
double *Central_Meridian,
155
double *Std_Parallel_1,
156
double *Std_Parallel_2,
157
double *False_Easting,
158
double *False_Northing);
160
/* The function Get_Albers_Parameters returns the current ellipsoid
161
* parameters, and Albers projection parameters.
163
* a : Semi-major axis of ellipsoid, in meters (output)
164
* f : Flattening of ellipsoid (output)
165
* Origin_Latitude : Latitude in radians at which the (output)
166
* point scale factor is 1.0
167
* Central_Meridian : Longitude in radians at the center of (output)
169
* Std_Parallel_1 : First standard parallel (output)
170
* Std_Parallel_2 : Second standard parallel (output)
171
* False_Easting : A coordinate value in meters assigned to the
172
* central meridian of the projection. (output)
173
* False_Northing : A coordinate value in meters assigned to the
174
* origin latitude of the projection (output)
178
long Convert_Geodetic_To_Albers (double Latitude,
183
/* The function Convert_Geodetic_To_Albers converts geodetic (latitude and
184
* longitude) coordinates to Albers projection (easting and northing)
185
* coordinates, according to the current ellipsoid and Albers projection
186
* parameters. If any errors occur, the error code(s) are returned by the
187
* function, otherwise ALBERS_NO_ERROR is returned.
189
* Latitude : Latitude (phi) in radians (input)
190
* Longitude : Longitude (lambda) in radians (input)
191
* Easting : Easting (X) in meters (output)
192
* Northing : Northing (Y) in meters (output)
196
long Convert_Albers_To_Geodetic(double Easting,
201
/* The function Convert_Albers_To_Geodetic converts Albers projection
202
* (easting and northing) coordinates to geodetic (latitude and longitude)
203
* coordinates, according to the current ellipsoid and Albers projection
204
* coordinates. If any errors occur, the error code(s) are returned by the
205
* function, otherwise ALBERS_NO_ERROR is returned.
207
* Easting : Easting (X) in meters (input)
208
* Northing : Northing (Y) in meters (input)
209
* Latitude : Latitude (phi) in radians (output)
210
* Longitude : Longitude (lambda) in radians (output)