4
/***************************************************************************/
5
/* RSC IDENTIFIER: MERCATOR
9
* This component provides conversions between Geodetic coordinates
10
* (latitude and longitude in radians) and Mercator projection coordinates
11
* (easting and northing in meters).
15
* This component checks parameters for valid values. If an invalid value
16
* is found, the error code is combined with the current error code using
17
* the bitwise or. This combining allows multiple error codes to be
18
* returned. The possible error codes are:
20
* MERC_NO_ERROR : No errors occurred in function
21
* MERC_LAT_ERROR : Latitude outside of valid range
22
* (-89.5 to 89.5 degrees)
23
* MERC_LON_ERROR : Longitude outside of valid range
24
* (-180 to 360 degrees)
25
* MERC_EASTING_ERROR : Easting outside of valid range
26
* (False_Easting +/- ~20,500,000 m,
27
* depending on ellipsoid parameters
28
* and Latitude_of_True_Scale)
29
* MERC_NORTHING_ERROR : Northing outside of valid range
30
* (False_Northing +/- ~23,500,000 m,
31
* depending on ellipsoid parameters
32
* and Latitude_of_True_Scale)
33
* MERC_LAT_OF_TRUE_SCALE_ERROR : Latitude of true scale outside of valid range
34
* (-89.5 to 89.5 degrees)
35
* MERC_CENT_MER_ERROR : Central meridian outside of valid range
36
* (-180 to 360 degrees)
37
* MERC_A_ERROR : Semi-major axis less than or equal to zero
38
* MERC_INV_F_ERROR : Inverse flattening outside of valid range
43
* MERCATOR is intended for reuse by any application that performs a
44
* Mercator projection or its inverse.
48
* Further information on MERCATOR can be found in the Reuse Manual.
50
* MERCATOR originated from : U.S. Army Topographic Engineering Center
51
* Geospatial Information Division
53
* Alexandria, VA 22310-3864
57
* None apply to this component.
61
* MERCATOR has no restrictions.
65
* MERCATOR was tested and certified in the following environments:
67
* 1. Solaris 2.5 with GCC, version 2.8.1
68
* 2. Windows 95 with MS Visual C++, version 6
74
* 10-02-97 Original Code
75
* 03-18-08 Changed 'origin latitude' to 'latitude of true scale'
79
/***************************************************************************/
84
#define MERC_NO_ERROR 0x0000
85
#define MERC_LAT_ERROR 0x0001
86
#define MERC_LON_ERROR 0x0002
87
#define MERC_EASTING_ERROR 0x0004
88
#define MERC_NORTHING_ERROR 0x0008
89
#define MERC_LAT_OF_TRUE_SCALE_ERROR 0x0010
90
#define MERC_CENT_MER_ERROR 0x0020
91
#define MERC_A_ERROR 0x0040
92
#define MERC_INV_F_ERROR 0x0080
95
/***************************************************************************/
101
/* ensure proper linkage to c++ programs */
106
long Set_Mercator_Parameters(double a,
108
double Latitude_of_True_Scale,
109
double Central_Meridian,
110
double False_Easting,
111
double False_Northing,
112
double *Scale_Factor);
114
* The function Set_Mercator_Parameters receives the ellipsoid parameters and
115
* Mercator projcetion parameters as inputs, and sets the corresponding state
116
* variables. It calculates and returns the scale factor. If any errors
117
* occur, the error code(s) are returned by the function, otherwise
118
* MERC_NO_ERROR is returned.
120
* a : Semi-major axis of ellipsoid, in meters (input)
121
* f : Flattening of ellipsoid (input)
122
* Latitude_of_True_Scale : Latitude in radians at which the (input)
123
* point scale factor is 1.0
124
* Central_Meridian : Longitude in radians at the center of (input)
126
* False_Easting : A coordinate value in meters assigned to the
127
* central meridian of the projection. (input)
128
* False_Northing : A coordinate value in meters assigned to the
129
* origin latitude of the projection (input)
130
* Scale_Factor : Multiplier which reduces distances in the
131
* projection to the actual distance on the
136
void Get_Mercator_Parameters(double *a,
138
double *Latitude_of_True_Scale,
139
double *Central_Meridian,
140
double *False_Easting,
141
double *False_Northing,
142
double *Scale_Factor);
144
* The function Get_Mercator_Parameters returns the current ellipsoid
145
* parameters, Mercator projection parameters, and scale factor.
147
* a : Semi-major axis of ellipsoid, in meters (output)
148
* f : Flattening of ellipsoid (output)
149
* Latitude_of_True_Scale : Latitude in radians at which the (output)
150
* point scale factor is 1.0
151
* Central_Meridian : Longitude in radians at the center of (output)
153
* False_Easting : A coordinate value in meters assigned to the
154
* central meridian of the projection. (output)
155
* False_Northing : A coordinate value in meters assigned to the
156
* origin latitude of the projection (output)
157
* Scale_Factor : Multiplier which reduces distances in the
158
* projection to the actual distance on the
163
long Convert_Geodetic_To_Mercator (double Latitude,
168
* The function Convert_Geodetic_To_Mercator converts geodetic (latitude and
169
* longitude) coordinates to Mercator projection easting, and northing
170
* coordinates, according to the current ellipsoid and Mercator projection
171
* parameters. If any errors occur, the error code(s) are returned by the
172
* function, otherwise MERC_NO_ERROR is returned.
174
* Latitude : Latitude (phi) in radians (input)
175
* Longitude : Longitude (lambda) in radians (input)
176
* Easting : Easting (X) in meters (output)
177
* Northing : Northing (Y) in meters (output)
181
long Convert_Mercator_To_Geodetic(double Easting,
186
* The function Convert_Mercator_To_Geodetic converts Mercator projection
187
* easting and northing coordinates to geodetic (latitude and longitude)
188
* coordinates, according to the current ellipsoid and Mercator projection
189
* coordinates. If any errors occur, the error code(s) are returned by the
190
* function, otherwise MERC_NO_ERROR is returned.
192
* Easting : Easting (X) in meters (input)
193
* Northing : Northing (Y) in meters (input)
194
* Latitude : Latitude (phi) in radians (output)
195
* Longitude : Longitude (lambda) in radians (output)
202
#endif /* MERCATOR_H */