1 /* definition of standard cartesian units */
2
3 #include <stddef.h>
4
5 #include "proj.h"
6
7 #define PJ_UNITS__
8 #include "proj_internal.h"
9
10 /* Field 2 that contains the multiplier to convert named units to meters
11 ** may be expressed by either a simple floating point constant or a
12 ** numerator/denomenator values (e.g. 1/1000) */
13 static const struct PJ_UNITS
14 pj_units[] = {
15 {"km", "1000", "Kilometer", 1000.0},
16 {"m", "1", "Meter", 1.0},
17 {"dm", "1/10", "Decimeter", 0.1},
18 {"cm", "1/100", "Centimeter", 0.01},
19 {"mm", "1/1000", "Millimeter", 0.001},
20 {"kmi", "1852", "International Nautical Mile", 1852.0},
21 {"in", "0.0254", "International Inch", 0.0254},
22 {"ft", "0.3048", "International Foot", 0.3048},
23 {"yd", "0.9144", "International Yard", 0.9144},
24 {"mi", "1609.344", "International Statute Mile", 1609.344},
25 {"fath", "1.8288", "International Fathom", 1.8288},
26 {"ch", "20.1168", "International Chain", 20.1168},
27 {"link", "0.201168", "International Link", 0.201168},
28 {"us-in", "1/39.37", "U.S. Surveyor's Inch", 100/3937.0},
29 {"us-ft", "0.304800609601219", "U.S. Surveyor's Foot", 1200/3937.0},
30 {"us-yd", "0.914401828803658", "U.S. Surveyor's Yard", 3600/3937.0},
31 {"us-ch", "20.11684023368047", "U.S. Surveyor's Chain", 79200/3937.0},
32 {"us-mi", "1609.347218694437", "U.S. Surveyor's Statute Mile", 6336000/3937.0},
33 {"ind-yd", "0.91439523", "Indian Yard", 0.91439523},
34 {"ind-ft", "0.30479841", "Indian Foot", 0.30479841},
35 {"ind-ch", "20.11669506", "Indian Chain", 20.11669506},
36 {nullptr, nullptr, nullptr, 0.0}
37 };
38
39 // For internal use
pj_list_linear_units()40 const PJ_UNITS *pj_list_linear_units()
41 {
42 return pj_units;
43 }
44
proj_list_units()45 const PJ_UNITS *proj_list_units()
46 {
47 return pj_units;
48 }
49
50 /* M_PI / 200 */
51 #define GRAD_TO_RAD 0.015707963267948967
52
53 const struct PJ_UNITS
54 pj_angular_units[] = {
55 {"rad", "1.0", "Radian", 1.0},
56 {"deg", "0.017453292519943296", "Degree", DEG_TO_RAD},
57 {"grad", "0.015707963267948967", "Grad", GRAD_TO_RAD},
58 {nullptr, nullptr, nullptr, 0.0}
59 };
60
61 // For internal use
pj_list_angular_units()62 const PJ_UNITS *pj_list_angular_units()
63 {
64 return pj_angular_units;
65 }
66
proj_list_angular_units()67 const PJ_UNITS *proj_list_angular_units()
68 {
69 return pj_angular_units;
70 }
71