UNCLASSIFIED

GeographicTranslator
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros
LambertConformalConic.h
Go to the documentation of this file.
1 // CLASSIFICATION: UNCLASSIFIED
2 
3 #ifndef LambertConformalConic1_H
4 #define LambertConformalConic1_H
5 
6 /***************************************************************************/
7 /* RSC IDENTIFIER: LAMBERT
8  *
9  * ABSTRACT
10  *
11  * This component provides conversions between Geodetic coordinates
12  * (latitude and longitude in radians) and Lambert Conformal Conic
13  * (1 or 2 Standard Parallel) projection coordinates (easting and northing in meters) defined
14  * by one standard parallel and specified scale true along that parallel, or two standard parallels.
15  * When both standard parallel parameters
16  * are set to the same latitude value, the result is a Lambert
17  * Conformal Conic projection with one standard parallel at the
18  * specified latitude.
19  *
20  * ERROR HANDLING
21  *
22  * This component checks parameters for valid values. If an invalid value
23  * is found the error code is combined with the current error code using
24  * the bitwise or. This combining allows multiple error codes to be
25  * returned. The possible error codes are:
26  *
27  * LAMBERT_NO_ERROR : No errors occurred in function
28  * LAMBERT_LAT_ERROR : Latitude outside of valid range
29  * (-90 to 90 degrees)
30  * LAMBERT_LON_ERROR : Longitude outside of valid range
31  * (-180 to 360 degrees)
32  * LAMBERT_EASTING_ERROR : Easting outside of valid range
33  * (depends on ellipsoid and projection
34  * parameters)
35  * LAMBERT_NORTHING_ERROR : Northing outside of valid range
36  * (depends on ellipsoid and projection
37  * parameters)
38  * LAMBERT_ORIGIN_LAT_ERROR : Origin latitude outside of valid
39  * range (-89 59 59.0 to 89 59 59.0 degrees)
40  * or within one second of 0 degrees
41  * LAMBERT_CENT_MER_ERROR : Central meridian outside of valid range
42  * (-180 to 360 degrees)
43  * LAMBERT_SCALE_FACTOR_ERROR : Scale factor greater than minimum scale
44  * factor (1.0e-9)
45  * LAMBERT_A_ERROR : Semi-major axis less than or equal to zero
46  * LAMBERT_INV_F_ERROR : Inverse flattening outside of valid range
47  * (250 to 350)
48  *
49  *
50  * REUSE NOTES
51  *
52  * LAMBERT is intended for reuse by any application that performs a Lambert
53  * Conformal Conic (1 or 2 Standard Parallel) projection or its inverse.
54  *
55  * REFERENCES
56  *
57  * Further information on LAMBERT can be found in the Reuse Manual.
58  *
59  * LAMBERT originated from:
60  * Information Technologoy - Spatial Reference Model(SRM)
61  * ISO/IEC FDIS 18026
62  *
63  * LICENSES
64  *
65  * None apply to this component.
66  *
67  * RESTRICTIONS
68  *
69  * LAMBERT has no restrictions.
70  *
71  * ENVIRONMENT
72  *
73  * LAMBERT was tested and certified in the following environments:
74  *
75  * 1. Solaris 2.5 with GCC, version 2.8.1
76  * 2. Windows 98/2000/XP with MS Visual C++, version 6
77  *
78  * MODIFICATIONS
79  *
80  * Date Description
81  * ---- -----------
82  * 03-05-2005 Original Code
83  * 03-02-2007 Original C++ Code
84  * 02-25-2009 Merged Lambert 1 and 2
85  *
86  */
87 
88 
89 #include "CoordinateSystem.h"
90 #include "CoordinateType.h"
91 
92 
93 namespace MSP
94 {
95  namespace CCS
96  {
97  class MapProjection5Parameters;
98  class MapProjection6Parameters;
99  class MapProjectionCoordinates;
100  class GeodeticCoordinates;
101 
102 
103  /***************************************************************************/
104  /*
105  * DEFINES
106  */
107 
109  {
110  public:
111 
112  /*
113  * The constructor receives the ellipsoid parameters and
114  * Lambert Conformal Conic (1 Standard Parallel) projection parameters as inputs, and sets the
115  * corresponding state variables. If any errors occur, an exception is thrown with a description
116  * of the error.
117  *
118  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input)
119  * ellipsoidFlattening : Flattening of ellipsoid (input)
120  * centralMeridian : Longitude of origin, in radians (input)
121  * originLatitude : Latitude of origin, in radians (input)
122  * falseEasting : False easting, in meters (input)
123  * falseNorthing : False northing, in meters (input)
124  * scaleFactor : Projection scale factor (input)
125  *
126  */
127 
128  LambertConformalConic( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double originLatitude, double falseEasting, double falseNorthing, double scaleFactor );
129 
130 
131  /*
132  * The constructor receives the ellipsoid parameters and
133  * Lambert Conformal Conic (2 Standard Parallel) projection parameters as inputs, and sets the
134  * corresponding state variables. If any errors occur, an exception is thrown
135  * with a description of the error.
136  *
137  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (input)
138  * ellipsoidFlattening : Flattening of ellipsoid (input)
139  * centralMeridian : Longitude of origin, in radians (input)
140  * originLatitude : Latitude of origin, in radians (input)
141  * standardParallel1 : First standard parallel, in radians (input)
142  * standardParallel2 : Second standard parallel, in radians (input)
143  * falseEasting : False easting, in meters (input)
144  * falseNorthing : False northing, in meters (input)
145  *
146  * Note that when the two standard parallel parameters are both set to the
147  * same latitude value, the result is a Lambert Conformal Conic projection
148  * with one standard parallel at the specified latitude.
149  */
150 
151  LambertConformalConic( double ellipsoidSemiMajorAxis, double ellipsoidFlattening, double centralMeridian, double originLatitude, double standardParallel1, double standardParallel2, double falseEasting, double falseNorthing );
152 
153 
155 
156 
157  ~LambertConformalConic( void );
158 
159 
161 
162 
163  /*
164  * The function get1StandardParallelParameters returns the current ellipsoid
165  * parameters and Lambert Conformal Conic (1 Standard Parallel) projection parameters.
166  *
167  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output)
168  * ellipsoidFlattening : Flattening of ellipsoid (output)
169  * centralMeridian : Longitude of origin, in radians (output)
170  * originLatitude : Latitude of origin, in radians (output)
171  * falseEasting : False easting, in meters (output)
172  * falseNorthing : False northing, in meters (output)
173  * scaleFactor : Projection scale factor (output)
174  */
175 
177 
178 
179  /*
180  * The function get2StandardParallelParameters returns the current ellipsoid
181  * parameters and Lambert Conformal Conic (2 Standard Parallel) projection parameters.
182  *
183  * ellipsoidSemiMajorAxis : Semi-major axis of ellipsoid, in meters (output)
184  * ellipsoidFlattening : Flattening of ellipsoid (output)
185  * centralMeridian : Longitude of origin, in radians (output)
186  * originLatitude : Latitude of origin, in radians (output)
187  * standardParallel1 : First standard parallel, in radians (output)
188  * standardParallel2 : Second standard parallel, in radians (output)
189  * falseEasting : False easting, in meters (output)
190  * falseNorthing : False northing, in meters (output)
191  */
192 
194 
195 
196  /*
197  * The function convertFromGeodetic converts Geodetic (latitude and
198  * longitude) coordinates to Lambert Conformal Conic (1 or 2 Standard Parallel) projection (easting
199  * and northing) coordinates, according to the current ellipsoid and
200  * Lambert Conformal Conic (1 or 2 Standard Parallel) projection parameters. If any errors occur, an
201  * exception is thrown with a description of the error.
202  *
203  * longitude : Longitude, in radians (input)
204  * latitude : Latitude, in radians (input)
205  * easting : Easting (X), in meters (output)
206  * northing : Northing (Y), in meters (output)
207  */
208 
210 
211 
212  /*
213  * The function convertToGeodetic converts Lambert Conformal
214  * Conic (1 or 2 Standard Parallel) projection (easting and northing) coordinates to Geodetic
215  * (latitude and longitude) coordinates, according to the current ellipsoid
216  * and Lambert Conformal Conic (1 or 2 Standard Parallel) projection parameters. If any errors occur,
217  * an exception is thrown with a description of the error.
218  *
219  * easting : Easting (X), in meters (input)
220  * northing : Northing (Y), in meters (input)
221  * longitude : Longitude, in radians (output)
222  * latitude : Latitude, in radians (output)
223  */
224 
226 
227  private:
228 
229  CoordinateType::Enum coordinateType;
230 
231  struct CommonParameters
232  {
233  double _lambertN; /* Ratio of angle between meridians */
234  double _lambertRho0; /* Height above ellipsoid */
235  double _lambertRhoOlat;
236  double _lambertT0;
237 
238  /* Lambert_Conformal_Conic projection Parameters */
239  double _lambertOriginLatitude; /* Latitude of origin in radians */
240  double _lambertFalseNorthing; /* False northing, in meters */
241  double _lambertScaleFactor; /* Scale Factor */
242  };
243 
244  /* Ellipsoid Parameters, default to WGS 84 */
245  double es; /* Eccentricity of ellipsoid */
246  double es_OVER_2; /* Eccentricity / 2.0 */
247  double Lambert_1_n; /* Ratio of angle between meridians */
248  double Lambert_1_rho0; /* Height above ellipsoid */
249  double Lambert_1_rho_olat;
250  double Lambert_1_t0;
251 
252  /* Lambert_Conformal_Conic projection Parameters */
253  double Lambert_Origin_Latitude; /* Latitude of origin in radians */
254  double Lambert_Origin_Long; /* Longitude of origin, in radians */
255  double Lambert_False_Northing; /* False northing, in meters */
256  double Lambert_False_Easting; /* False easting, in meters */
257  double Lambert_Scale_Factor; /* Scale Factor */
258 
259  /* Lambert_Conformal_Conic 2 projection Parameters */
260  double Lambert_2_Std_Parallel_1; /* Lower std. parallel, in radians */
261  double Lambert_2_Std_Parallel_2; /* Upper std. parallel, in radians */
262  double Lambert_2_Origin_Lat; /* Latitude of origin, in radians */
263 
264  /* Maximum variance for easting and northing values for WGS 84. */
265  double Lambert_Delta_Easting;
266  double Lambert_Delta_Northing;
267 
268 
269  CommonParameters* setCommonLambert1StandardParallelParameters(double originLatitude, double falseNorthing, double scaleFactor);
270 
271  double calculateLambert2StandardParallel(double es2, double phi, double tempPhi, double c);
272 
273  double lambertM( double clat, double essin );
274 
275  double lambertT( double lat, double essin );
276 
277  double esSin(double sinlat);
278  };
279  }
280 }
281 
282 #endif
283 
284 
285 // CLASSIFICATION: UNCLASSIFIED