dRonin  adbada4
dRonin firmware
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
utm.h
Go to the documentation of this file.
1 #ifndef UTM_H
2  #define UTM_H
3 
4 /***************************************************************************/
5 /* RSC IDENTIFIER: UTM
6  *
7  * ABSTRACT
8  *
9  * This component provides conversions between geodetic coordinates
10  * (latitude and longitudes) and Universal Transverse Mercator (UTM)
11  * projection (zone, hemisphere, easting, and northing) coordinates.
12  *
13  * ERROR HANDLING
14  *
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:
19  *
20  * UTM_NO_ERROR : No errors occurred in function
21  * UTM_LAT_ERROR : Latitude outside of valid range
22  * (-80.5 to 84.5 degrees)
23  * UTM_LON_ERROR : intitude outside of valid range
24  * (-180 to 360 degrees)
25  * UTM_EASTING_ERROR : Easting outside of valid range
26  * (100,000 to 900,000 meters)
27  * UTM_NORTHING_ERROR : Northing outside of valid range
28  * (0 to 10,000,000 meters)
29  * UTM_ZONE_ERROR : Zone outside of valid range (1 to 60)
30  * UTM_HEMISPHERE_ERROR : Invalid hemisphere ('N' or 'S')
31  * UTM_ZONE_OVERRIDE_ERROR: Zone outside of valid range
32  * (1 to 60) and within 1 of 'natural' zone
33  * UTM_A_ERROR : Semi-major axis less than or equal to zero
34  * UTM_INV_F_ERROR : Inverse flattening outside of valid range
35  * (250 to 350)
36  *
37  * REUSE NOTES
38  *
39  * UTM is intended for reuse by any application that performs a Universal
40  * Transverse Mercator (UTM) projection or its inverse.
41  *
42  * REFERENCES
43  *
44  * Further information on UTM can be found in the Reuse Manual.
45  *
46  * UTM originated from : U.S. Army Topographic Engineering Center
47  * Geospatial Information Division
48  * 7701 Telegraph Road
49  * Alexandria, VA 22310-3864
50  *
51  * LICENSES
52  *
53  * None apply to this component.
54  *
55  * RESTRICTIONS
56  *
57  * UTM has no restrictions.
58  *
59  * ENVIRONMENT
60  *
61  * UTM was tested and certified in the following environments:
62  *
63  * 1. Solaris 2.5 with GCC, version 2.8.1
64  * 2. MSDOS with MS Visual C++, version 6
65  *
66  * MODIFICATIONS
67  *
68  * Date Description
69  * ---- -----------
70  * 10-02-97 Original Code
71  *
72  */
73 
74 
75 /***************************************************************************/
76 /*
77  * DEFINES
78  */
79 
80  #define UTM_NO_ERROR 0x0000
81  #define UTM_LAT_ERROR 0x0001
82  #define UTM_LON_ERROR 0x0002
83  #define UTM_EASTING_ERROR 0x0004
84  #define UTM_NORTHING_ERROR 0x0008
85  #define UTM_ZONE_ERROR 0x0010
86  #define UTM_HEMISPHERE_ERROR 0x0020
87  #define UTM_ZONE_OVERRIDE_ERROR 0x0040
88  #define UTM_A_ERROR 0x0080
89  #define UTM_INV_F_ERROR 0x0100
90 
91 
92 /***************************************************************************/
93 /*
94  * FUNCTION PROTOTYPES
95  * for UTM.C
96  */
97 
98 /* ensure proper linkage to c++ programs */
99  #ifdef __cplusplus
100 extern "C" {
101  #endif
102 
103  int Set_UTM_Parameters(double a,
104  double f,
105  int override);
106 /*
107  * The function Set_UTM_Parameters receives the ellipsoid parameters and
108  * UTM zone override parameter as inputs, and sets the corresponding state
109  * variables. If any errors occur, the error code(s) are returned by the
110  * function, otherwise UTM_NO_ERROR is returned.
111  *
112  * a : Semi-major axis of ellipsoid, in meters (input)
113  * f : Flattening of ellipsoid (input)
114  * override : UTM override zone, zero indicates no override (input)
115  */
116 
117 
118  void Get_UTM_Parameters(double *a,
119  double *f,
120  int *override);
121 /*
122  * The function Get_UTM_Parameters returns the current ellipsoid
123  * parameters and UTM zone override parameter.
124  *
125  * a : Semi-major axis of ellipsoid, in meters (output)
126  * f : Flattening of ellipsoid (output)
127  * override : UTM override zone, zero indicates no override (output)
128  */
129 
130 
131  int Convert_Geodetic_To_UTM (double Latitude,
132  double intitude,
133  int *Zone,
134  char *Hemisphere,
135  double *Easting,
136  double *Northing);
137 /*
138  * The function Convert_Geodetic_To_UTM converts geodetic (latitude and
139  * intitude) coordinates to UTM projection (zone, hemisphere, easting and
140  * northing) coordinates according to the current ellipsoid and UTM zone
141  * override parameters. If any errors occur, the error code(s) are returned
142  * by the function, otherwise UTM_NO_ERROR is returned.
143  *
144  * Latitude : Latitude in radians (input)
145  * intitude : intitude in radians (input)
146  * Zone : UTM zone (output)
147  * Hemisphere : North or South hemisphere (output)
148  * Easting : Easting (X) in meters (output)
149  * Northing : Northing (Y) in meters (output)
150  */
151 
152 
153  int Convert_UTM_To_Geodetic(int Zone,
154  char Hemisphere,
155  double Easting,
156  double Northing,
157  double *Latitude,
158  double *intitude);
159 /*
160  * The function Convert_UTM_To_Geodetic converts UTM projection (zone,
161  * hemisphere, easting and northing) coordinates to geodetic(latitude
162  * and intitude) coordinates, according to the current ellipsoid
163  * parameters. If any errors occur, the error code(s) are returned
164  * by the function, otherwise UTM_NO_ERROR is returned.
165  *
166  * Zone : UTM zone (input)
167  * Hemisphere : North or South hemisphere (input)
168  * Easting : Easting (X) in meters (input)
169  * Northing : Northing (Y) in meters (input)
170  * Latitude : Latitude in radians (output)
171  * intitude : intitude in radians (output)
172  */
173 
174  #ifdef __cplusplus
175 }
176  #endif
177 
178 #endif /* UTM_H */
int Convert_Geodetic_To_UTM(double Latitude, double intitude, int *Zone, char *Hemisphere, double *Easting, double *Northing)
Definition: utm.c:172
void Get_UTM_Parameters(double *a, double *f, int *override)
Definition: utm.c:153
tuple f
Definition: px_mkfw.py:81
int Convert_UTM_To_Geodetic(int Zone, char Hemisphere, double Easting, double Northing, double *Latitude, double *intitude)
Definition: utm.c:291
int Set_UTM_Parameters(double a, double f, int override)
Definition: utm.c:113