proj4rb 3.0.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/ChangeLog +26 -15
  3. data/README.rdoc +82 -44
  4. data/Rakefile +27 -27
  5. data/lib/api/api.rb +96 -118
  6. data/lib/api/api_5_0.rb +331 -300
  7. data/lib/api/api_5_1.rb +6 -6
  8. data/lib/api/api_5_2.rb +4 -4
  9. data/lib/api/api_6_0.rb +116 -14
  10. data/lib/api/api_6_1.rb +4 -4
  11. data/lib/api/api_6_2.rb +9 -6
  12. data/lib/api/api_6_3.rb +6 -0
  13. data/lib/api/api_7_0.rb +68 -0
  14. data/lib/api/api_7_1.rb +73 -0
  15. data/lib/api/api_7_2.rb +14 -0
  16. data/lib/api/api_8_0.rb +6 -0
  17. data/lib/api/api_8_1.rb +24 -0
  18. data/lib/api/api_8_2.rb +6 -0
  19. data/lib/api/api_9_1.rb +7 -0
  20. data/lib/api/api_9_2.rb +9 -0
  21. data/lib/api/api_experimental.rb +196 -0
  22. data/lib/proj/area.rb +73 -32
  23. data/lib/proj/axis_info.rb +44 -0
  24. data/lib/proj/bounds.rb +13 -0
  25. data/lib/proj/context.rb +174 -28
  26. data/lib/proj/conversion.rb +92 -0
  27. data/lib/proj/coordinate.rb +281 -197
  28. data/lib/proj/coordinate_operation_mixin.rb +381 -0
  29. data/lib/proj/coordinate_system.rb +137 -0
  30. data/lib/proj/crs.rb +672 -204
  31. data/lib/proj/crs_info.rb +47 -0
  32. data/lib/proj/database.rb +305 -0
  33. data/lib/proj/datum.rb +32 -0
  34. data/lib/proj/datum_ensemble.rb +34 -0
  35. data/lib/proj/ellipsoid.rb +77 -41
  36. data/lib/proj/error.rb +62 -9
  37. data/lib/proj/file_api.rb +166 -0
  38. data/lib/proj/grid.rb +121 -0
  39. data/lib/proj/grid_cache.rb +64 -0
  40. data/lib/proj/grid_info.rb +19 -0
  41. data/lib/proj/network_api.rb +92 -0
  42. data/lib/proj/operation.rb +42 -42
  43. data/lib/proj/operation_factory_context.rb +136 -0
  44. data/lib/proj/parameter.rb +38 -0
  45. data/lib/proj/parameters.rb +106 -0
  46. data/lib/proj/pj_object.rb +670 -80
  47. data/lib/proj/pj_objects.rb +44 -0
  48. data/lib/proj/prime_meridian.rb +65 -39
  49. data/lib/proj/projection.rb +698 -207
  50. data/lib/proj/session.rb +46 -0
  51. data/lib/proj/strings.rb +32 -0
  52. data/lib/proj/transformation.rb +101 -60
  53. data/lib/proj/unit.rb +108 -53
  54. data/lib/proj.rb +110 -9
  55. data/proj4rb.gemspec +5 -5
  56. data/test/abstract_test.rb +23 -1
  57. data/test/context_test.rb +172 -82
  58. data/test/conversion_test.rb +368 -0
  59. data/test/coordinate_system_test.rb +144 -0
  60. data/test/crs_test.rb +770 -71
  61. data/test/database_test.rb +360 -0
  62. data/test/datum_ensemble_test.rb +65 -0
  63. data/test/datum_test.rb +55 -0
  64. data/test/ellipsoid_test.rb +64 -18
  65. data/test/file_api_test.rb +66 -0
  66. data/test/grid_cache_test.rb +72 -0
  67. data/test/grid_test.rb +141 -0
  68. data/test/network_api_test.rb +45 -0
  69. data/test/operation_factory_context_test.rb +201 -0
  70. data/test/parameters_test.rb +40 -0
  71. data/test/pj_object_test.rb +179 -0
  72. data/test/prime_meridian_test.rb +76 -0
  73. data/test/proj_test.rb +46 -4
  74. data/test/projection_test.rb +646 -222
  75. data/test/session_test.rb +78 -0
  76. data/test/transformation_test.rb +149 -7
  77. data/test/unit_test.rb +57 -28
  78. metadata +51 -13
  79. data/lib/api/api_4_9.rb +0 -31
  80. data/lib/proj/config.rb +0 -70
  81. data/lib/proj/point.rb +0 -72
  82. data/test/prime_meridians_test.rb +0 -33
data/lib/api/api_5_0.rb CHANGED
@@ -1,301 +1,332 @@
1
- module Proj
2
- module Api
3
- typedef :pointer, :PJ
4
- typedef :pointer, :PJ_CONTEXT
5
- typedef :pointer, :PJ_AREA
6
-
7
- class P5_FACTORS < FFI::Struct
8
- layout :meridional_scale, :double, # h
9
- :parallel_scale, :double, # k
10
- :areal_scale, :double, # s
11
-
12
- :angular_distortion, :double, # omega
13
- :meridian_parallel_angle, :double, # theta-prime
14
- :meridian_convergence, :double, # alpha
15
-
16
- :tissot_semimajor, :double, # a
17
- :tissot_semiminor, :double, # b
18
-
19
- :dx_dlam, :double,
20
- :dx_dphi, :double,
21
- :dy_dlam, :double,
22
- :dy_dphi, :double
23
- end
24
-
25
- # Data types for list of operations, ellipsoids, datums and units used in PROJ.4 */
26
- class PJ_LIST < FFI::Struct
27
- layout :id, :string, # projection keyword
28
- :PJ, :pointer, # projection entry point
29
- :descr, :pointer # description text
30
- end
31
- PJ_OPERATIONS = PJ_LIST
32
-
33
- class PJ_ELLPS < FFI::Struct
34
- layout :id, :string, # ellipse keyword name
35
- :major, :string, # a= value
36
- :ell, :string, # elliptical parameter
37
- :name, :string # comments
38
- end
39
-
40
- class PJ_UNITS < FFI::Struct
41
- layout :id, :string, # units keyword
42
- :to_meter, :string, # multiply by value to get meters
43
- :name, :string, # comments
44
- :factor, :double # to_meter factor in actual numbers
45
- end
46
-
47
- class PJ_PRIME_MERIDIANS < FFI::Struct
48
- layout :id, :string, # prime meridian keyword
49
- :defn, :string # offset from greenwich in DMS format.
50
- end
51
-
52
- # Geodetic, mostly spatiotemporal coordinate types
53
- class PJ_XYZT < FFI::Struct
54
- layout :x, :double,
55
- :y, :double,
56
- :z, :double,
57
- :t, :double
58
- end
59
-
60
- class PJ_UVWT < FFI::Struct
61
- layout :u, :double,
62
- :v, :double,
63
- :w, :double,
64
- :t, :double
65
- end
66
-
67
- class PJ_LPZT < FFI::Struct
68
- layout :lam, :double,
69
- :phi, :double,
70
- :z, :double,
71
- :t, :double
72
- end
73
-
74
- # Rotations: omega, phi, kappa
75
- class PJ_OPK < FFI::Struct
76
- layout :o, :double,
77
- :p, :double,
78
- :k, :double
79
- end
80
-
81
- # East, North, Up
82
- class PJ_ENU < FFI::Struct
83
- layout :e, :double,
84
- :n, :double,
85
- :u, :double
86
- end
87
-
88
- # Geodesic length, fwd azi, rev azi
89
- class PJ_GEOD < FFI::Struct
90
- layout :s, :double,
91
- :a1, :double,
92
- :a2, :double
93
- end
94
-
95
- # Classic proj.4 pair/triplet types - moved into the PJ_ name space.
96
- class PJ_UV < FFI::Struct
97
- layout :u, :double,
98
- :v, :double
99
- end
100
-
101
- class PJ_XY < FFI::Struct
102
- layout :x, :double,
103
- :y, :double
104
- end
105
-
106
- class PJ_LP < FFI::Struct
107
- layout :lam, :double,
108
- :phi, :double
109
- end
110
-
111
- class PJ_XYZ < FFI::Struct
112
- layout :x, :double,
113
- :y, :double,
114
- :z, :double
115
- end
116
-
117
- class PJ_UVW < FFI::Struct
118
- layout :u, :double,
119
- :v, :double,
120
- :w, :double
121
- end
122
-
123
- class PJ_LPZ < FFI::Struct
124
- layout :lam, :double,
125
- :phi, :double,
126
- :z, :double
127
- end
128
-
129
- class PJ_COORD < FFI::Union
130
- layout :v, [:double, 4],
131
- :xyzt, PJ_XYZT,
132
- :uvwt, PJ_UVWT,
133
- :lpzt, PJ_LPZT,
134
- :geod, PJ_GEOD,
135
- :opk, PJ_OPK,
136
- :enu, PJ_ENU,
137
- :xyz, PJ_XYZ,
138
- :uvw, PJ_UVW,
139
- :lpz, PJ_LPZ,
140
- :xy, PJ_XY,
141
- :uv, PJ_UV,
142
- :lp, PJ_LP
143
- end
144
-
145
- class PJ_INFO < FFI::Struct
146
- layout :major, :int, # Major release number
147
- :minor, :int, # Minor release number
148
- :patch, :int, # Patch level
149
- :release, :string, # Release info. Version + date
150
- :version, :string, # Full version number
151
- :searchpath, :string, # Paths where init and grid files are looked for. Paths are separated by
152
- # semi-colons on Windows, and colons on non-Windows platforms.
153
- :paths, :pointer,
154
- :path_count, :size_t
155
- end
156
-
157
- class PJ_PROJ_INFO < FFI::Struct
158
- layout :id, :string, # Name of the projection in question
159
- :description, :string, # Description of the projection
160
- :definition, :string, # Projection definition
161
- :has_inverse, :int, # 1 if an inverse mapping exists, 0 otherwise
162
- :accuracy, :double # Expected accuracy of the transformation. -1 if unknown.
163
-
164
- def to_s
165
- "<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}"
166
- end
167
- end
168
-
169
- class PJ_GRID_INFO < FFI::Struct
170
- layout :gridname, [:string, 32], # name of grid
171
- :filename, [:string, 260], # full path to grid
172
- :format, [:string, 8], # file format of grid
173
- :lowerleft, PJ_LP, # Coordinates of lower left corner
174
- :upperright, PJ_LP, # Coordinates of upper right corner
175
- :n_lon, :int, # Grid size
176
- :n_lat, :int, # Grid size
177
- :cs_lon, :double, # Cell size of grid
178
- :cs_lat, :double # Cell size of grid
179
- end
180
-
181
- class PJ_INIT_INFO < FFI::Struct
182
- layout :name, [:string, 32], # name init file
183
- :filename, [:string, 260], # full path to the init file
184
- :version, [:string, 32], # version of the init file
185
- :origin, [:string, 32], # origin of the file, e.g. EPSG
186
- :lastupdate, [:string, 16] # Date of last update in YYYY-MM-DD format
187
- end
188
-
189
- enum :PJ_LOG_LEVEL, [:PJ_LOG_NONE , 0,
190
- :PJ_LOG_ERROR, 1,
191
- :PJ_LOG_DEBUG, 2,
192
- :PJ_LOG_TRACE, 3,
193
- :PJ_LOG_TELL , 4,
194
- :PJ_LOG_DEBUG_MAJOR, 2, # for proj_api.h compatibility
195
- :PJ_LOG_DEBUG_MINOR, 3] # for proj_api.h compatibility
196
-
197
- # Apply transformation to observation - in forward or inverse direction
198
- enum :PJ_DIRECTION, [:PJ_FWD, 1, # Forward
199
- :PJ_IDENT, 0, # Do nothing
200
- :PJ_INV, -1] # Inverse
201
-
202
- enum :PJ_CATEGORY, [:PJ_CATEGORY_ELLIPSOID,
203
- :PJ_CATEGORY_PRIME_MERIDIAN,
204
- :PJ_CATEGORY_DATUM,
205
- :PJ_CATEGORY_CRS,
206
- :PJ_CATEGORY_COORDINATE_OPERATION]
207
-
208
- enum :PJ_TYPE, [:PJ_TYPE_UNKNOWN,
209
- :PJ_TYPE_ELLIPSOID,
210
- :PJ_TYPE_PRIME_MERIDIAN,
211
- :PJ_TYPE_GEODETIC_REFERENCE_FRAME,
212
- :PJ_TYPE_DYNAMIC_GEODETIC_REFERENCE_FRAME,
213
- :PJ_TYPE_VERTICAL_REFERENCE_FRAME,
214
- :PJ_TYPE_DYNAMIC_VERTICAL_REFERENCE_FRAME,
215
- :PJ_TYPE_DATUM_ENSEMBLE,
216
-
217
- # Abstract type, not returned by proj_get_type()
218
- :PJ_TYPE_CRS,
219
-
220
- :PJ_TYPE_GEODETIC_CRS,
221
- :PJ_TYPE_GEOCENTRIC_CRS,
222
-
223
- # proj_get_type() will never return that type, but
224
- # :PJ_TYPE_GEOGRAPHIC_2D_CRS or :PJ_TYPE_GEOGRAPHIC_3D_CRS.
225
- :PJ_TYPE_GEOGRAPHIC_CRS,
226
-
227
- :PJ_TYPE_GEOGRAPHIC_2D_CRS,
228
- :PJ_TYPE_GEOGRAPHIC_3D_CRS,
229
- :PJ_TYPE_VERTICAL_CRS,
230
- :PJ_TYPE_PROJECTED_CRS,
231
- :PJ_TYPE_COMPOUND_CRS,
232
- :PJ_TYPE_TEMPORAL_CRS,
233
- :PJ_TYPE_ENGINEERING_CRS,
234
- :PJ_TYPE_BOUND_CRS,
235
- :PJ_TYPE_OTHER_CRS,
236
-
237
- :PJ_TYPE_CONVERSION,
238
- :PJ_TYPE_TRANSFORMATION,
239
- :PJ_TYPE_CONCATENATED_OPERATION,
240
- :PJ_TYPE_OTHER_COORDINATE_OPERATION]
241
-
242
- enum :PJ_PROJ_STRING_TYPE, [:PJ_PROJ_5,
243
- :PJ_PROJ_4]
244
-
245
- enum :PJ_COORDINATE_SYSTEM_TYPE, [:PJ_CS_TYPE_UNKNOWN,
246
- :PJ_CS_TYPE_CARTESIAN,
247
- :PJ_CS_TYPE_ELLIPSOIDAL,
248
- :PJ_CS_TYPE_VERTICAL,
249
- :PJ_CS_TYPE_SPHERICAL,
250
- :PJ_CS_TYPE_ORDINAL,
251
- :PJ_CS_TYPE_PARAMETRIC,
252
- :PJ_CS_TYPE_DATETIMETEMPORAL,
253
- :PJ_CS_TYPE_TEMPORALCOUNT,
254
- :PJ_CS_TYPE_TEMPORALMEASURE]
255
-
256
- enum :PJ_WKT_TYPE, [:PJ_WKT2_2015,
257
- :PJ_WKT2_2015_SIMPLIFIED,
258
- :PJ_WKT2_2018,
259
- :PJ_WKT2_2018_SIMPLIFIED,
260
- :PJ_WKT1_GDAL,
261
- :PJ_WKT1_ESRI]
262
-
263
- attach_function :proj_info, [], PJ_INFO.by_value
264
- attach_function :proj_pj_info, [:PJ], PJ_PROJ_INFO.by_value
265
- attach_function :proj_grid_info, [:string], PJ_GRID_INFO.by_value
266
- attach_function :proj_init_info, [:string], PJ_INIT_INFO.by_value
267
-
268
- # Contexts
269
- attach_function :proj_context_create, [], :PJ_CONTEXT
270
- attach_function :proj_context_destroy, [:PJ_CONTEXT], :PJ_CONTEXT
271
-
272
- # Error handling
273
- attach_function :proj_context_errno, [:PJ_CONTEXT], :int
274
- attach_function :proj_errno, [:PJ], :int
275
- attach_function :proj_errno_set, [:PJ, :int], :int
276
- attach_function :proj_errno_reset, [:PJ], :int
277
- attach_function :proj_errno_restore, [:PJ, :int], :int
278
-
279
- # Manage the transformation definition object PJ
280
- attach_function :proj_create, [:PJ_CONTEXT, :string], :PJ
281
- attach_function :proj_create_argv, [:PJ_CONTEXT, :int, :pointer], :PJ
282
- attach_function :proj_create_crs_to_crs, [:PJ_CONTEXT, :string, :string, :PJ_AREA], :PJ
283
- attach_function :proj_destroy, [:PJ], :PJ
284
-
285
- attach_function :proj_trans, [:PJ, :PJ_DIRECTION, PJ_COORD.by_value], PJ_COORD.by_value
286
-
287
- # Get lists of operations, ellipsoids, units and prime meridians
288
- attach_function :proj_list_operations, [], :pointer #PJ_LIST
289
- attach_function :proj_list_ellps, [], :pointer #PJ_ELLPS
290
- attach_function :proj_list_units, [], :pointer #PJ_UNITS
291
- attach_function :proj_list_prime_meridians, [], :pointer #PJ_PRIME_MERIDIANS
292
-
293
- # Degrees/radians
294
- attach_function :proj_torad, [:double], :double
295
- attach_function :proj_todeg, [:double], :double
296
- attach_function :proj_dmstor, [:string, :pointer], :double
297
- attach_function :proj_rtodms, [:string, :double, :int, :int], :string
298
- attach_function :proj_angular_input, [:PJ, :PJ_DIRECTION], :bool
299
- attach_function :proj_angular_output, [:PJ, :PJ_DIRECTION], :bool
300
- end
1
+ module Proj
2
+ module Api
3
+ typedef :pointer, :PJ
4
+ typedef :pointer, :PJ_CONTEXT
5
+ typedef :pointer, :PJ_AREA
6
+
7
+ class PJ_FACTORS < FFI::Struct
8
+ layout :meridional_scale, :double, # h
9
+ :parallel_scale, :double, # k
10
+ :areal_scale, :double, # s
11
+
12
+ :angular_distortion, :double, # omega
13
+ :meridian_parallel_angle, :double, # theta-prime
14
+ :meridian_convergence, :double, # alpha
15
+
16
+ :tissot_semimajor, :double, # a
17
+ :tissot_semiminor, :double, # b
18
+
19
+ :dx_dlam, :double,
20
+ :dx_dphi, :double,
21
+ :dy_dlam, :double,
22
+ :dy_dphi, :double
23
+ end
24
+
25
+ # Data types for list of operations, ellipsoids, datums and units used in PROJ.4
26
+ class PJ_LIST < FFI::Struct
27
+ layout :id, :string, # projection keyword
28
+ :PJ, :pointer, # projection entry point
29
+ :descr, :pointer # description text
30
+ end
31
+ PJ_OPERATIONS = PJ_LIST
32
+
33
+ class PJ_ELLPS < FFI::Struct
34
+ layout :id, :string, # ellipse keyword name
35
+ :major, :string, # a= value
36
+ :ell, :string, # elliptical parameter
37
+ :name, :string # comments
38
+ end
39
+
40
+ class PJ_UNITS < FFI::Struct
41
+ layout :id, :string, # units keyword
42
+ :to_meter, :string, # multiply by value to get meters
43
+ :name, :string, # comments
44
+ :factor, :double # to_meter factor in actual numbers
45
+ end
46
+
47
+ class PJ_PRIME_MERIDIANS < FFI::Struct
48
+ layout :id, :string, # prime meridian keyword
49
+ :defn, :string # offset from greenwich in DMS format.
50
+ end
51
+
52
+ # Geodetic, mostly spatiotemporal coordinate types
53
+ class PJ_XYZT < FFI::Struct
54
+ layout :x, :double,
55
+ :y, :double,
56
+ :z, :double,
57
+ :t, :double
58
+ end
59
+
60
+ class PJ_UVWT < FFI::Struct
61
+ layout :u, :double,
62
+ :v, :double,
63
+ :w, :double,
64
+ :t, :double
65
+ end
66
+
67
+ class PJ_LPZT < FFI::Struct
68
+ layout :lam, :double,
69
+ :phi, :double,
70
+ :z, :double,
71
+ :t, :double
72
+ end
73
+
74
+ # Rotations: omega, phi, kappa
75
+ class PJ_OPK < FFI::Struct
76
+ layout :o, :double,
77
+ :p, :double,
78
+ :k, :double
79
+ end
80
+
81
+ # East, North, Up
82
+ class PJ_ENU < FFI::Struct
83
+ layout :e, :double,
84
+ :n, :double,
85
+ :u, :double
86
+ end
87
+
88
+ # Geodesic length, fwd azi, rev azi
89
+ class PJ_GEOD < FFI::Struct
90
+ layout :s, :double,
91
+ :a1, :double,
92
+ :a2, :double
93
+ end
94
+
95
+ # Classic proj.4 pair/triplet types - moved into the PJ_ name space.
96
+ class PJ_UV < FFI::Struct
97
+ layout :u, :double,
98
+ :v, :double
99
+ end
100
+
101
+ class PJ_XY < FFI::Struct
102
+ layout :x, :double,
103
+ :y, :double
104
+ end
105
+
106
+ class PJ_LP < FFI::Struct
107
+ layout :lam, :double,
108
+ :phi, :double
109
+ end
110
+
111
+ class PJ_XYZ < FFI::Struct
112
+ layout :x, :double,
113
+ :y, :double,
114
+ :z, :double
115
+ end
116
+
117
+ class PJ_UVW < FFI::Struct
118
+ layout :u, :double,
119
+ :v, :double,
120
+ :w, :double
121
+ end
122
+
123
+ class PJ_LPZ < FFI::Struct
124
+ layout :lam, :double,
125
+ :phi, :double,
126
+ :z, :double
127
+ end
128
+
129
+ class PJ_COORD < FFI::Union
130
+ layout :v, [:double, 4],
131
+ :xyzt, PJ_XYZT,
132
+ :uvwt, PJ_UVWT,
133
+ :lpzt, PJ_LPZT,
134
+ :geod, PJ_GEOD,
135
+ :opk, PJ_OPK,
136
+ :enu, PJ_ENU,
137
+ :xyz, PJ_XYZ,
138
+ :uvw, PJ_UVW,
139
+ :lpz, PJ_LPZ,
140
+ :xy, PJ_XY,
141
+ :uv, PJ_UV,
142
+ :lp, PJ_LP
143
+
144
+ def eql?(other)
145
+ self[:v][0] == other[:v][0] &&
146
+ self[:v][1] == other[:v][1] &&
147
+ self[:v][2] == other[:v][2] &&
148
+ self[:v][3] == other[:v][3]
149
+ end
150
+
151
+ def ==(other)
152
+ self.eql?(other)
153
+ end
154
+ end
155
+
156
+ class PJ_INFO < FFI::Struct
157
+ layout :major, :int, # Major release number
158
+ :minor, :int, # Minor release number
159
+ :patch, :int, # Patch level
160
+ :release, :string, # Release info. Version + date
161
+ :version, :string, # Full version number
162
+ :searchpath, :string, # Paths where init and grid files are looked for. Paths are separated by
163
+ # semi-colons on Windows, and colons on non-Windows platforms.
164
+ :paths, :pointer,
165
+ :path_count, :size_t
166
+ end
167
+
168
+ class PJ_PROJ_INFO < FFI::Struct
169
+ layout :id, :string, # Name of the projection in question
170
+ :description, :string, # Description of the projection
171
+ :definition, :string, # Projection definition
172
+ :has_inverse, :int, # 1 if an inverse mapping exists, 0 otherwise
173
+ :accuracy, :double # Expected accuracy of the transformation. -1 if unknown.
174
+
175
+ def to_s
176
+ "<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}"
177
+ end
178
+ end
179
+
180
+ class PJ_GRID_INFO < FFI::Struct
181
+ layout :gridname, [:char, 32], # name of grid
182
+ :filename, [:char, 260], # full path to grid
183
+ :format, [:char, 8], # file format of grid
184
+ :lowerleft, PJ_LP, # Coordinates of lower left corner
185
+ :upperright, PJ_LP, # Coordinates of upper right corner
186
+ :n_lon, :int, # Grid size
187
+ :n_lat, :int, # Grid size
188
+ :cs_lon, :double, # Cell size of grid
189
+ :cs_lat, :double # Cell size of grid
190
+ end
191
+
192
+ class PJ_INIT_INFO < FFI::Struct
193
+ layout :name, [:string, 32], # name init file
194
+ :filename, [:string, 260], # full path to the init file
195
+ :version, [:string, 32], # version of the init file
196
+ :origin, [:string, 32], # origin of the file, e.g. EPSG
197
+ :lastupdate, [:string, 16] # Date of last update in YYYY-MM-DD format
198
+ end
199
+
200
+ PJ_LOG_LEVEL = enum(:PJ_LOG_NONE , 0,
201
+ :PJ_LOG_ERROR, 1,
202
+ :PJ_LOG_DEBUG, 2,
203
+ :PJ_LOG_TRACE, 3,
204
+ :PJ_LOG_TELL , 4,
205
+ :PJ_LOG_DEBUG_MAJOR, 2, # for proj_api.h compatibility
206
+ :PJ_LOG_DEBUG_MINOR, 3) # for proj_api.h compatibility
207
+
208
+ # Apply transformation to observation - in forward or inverse direction
209
+ PJ_DIRECTION = enum(:PJ_FWD, 1, # Forward
210
+ :PJ_IDENT, 0, # Do nothing
211
+ :PJ_INV, -1) # Inverse
212
+
213
+ # Object category
214
+ PJ_CATEGORY = enum(:PJ_CATEGORY_ELLIPSOID,
215
+ :PJ_CATEGORY_PRIME_MERIDIAN,
216
+ :PJ_CATEGORY_DATUM,
217
+ :PJ_CATEGORY_CRS,
218
+ :PJ_CATEGORY_COORDINATE_OPERATION,
219
+ :PJ_CATEGORY_DATUM_ENSEMBLE)
220
+
221
+ PJ_TYPE = enum(:PJ_TYPE_UNKNOWN,
222
+ :PJ_TYPE_ELLIPSOID,
223
+ :PJ_TYPE_PRIME_MERIDIAN,
224
+ :PJ_TYPE_GEODETIC_REFERENCE_FRAME,
225
+ :PJ_TYPE_DYNAMIC_GEODETIC_REFERENCE_FRAME,
226
+ :PJ_TYPE_VERTICAL_REFERENCE_FRAME,
227
+ :PJ_TYPE_DYNAMIC_VERTICAL_REFERENCE_FRAME,
228
+ :PJ_TYPE_DATUM_ENSEMBLE,
229
+
230
+ # Abstract type, not returned by proj_get_type()
231
+ :PJ_TYPE_CRS,
232
+
233
+ :PJ_TYPE_GEODETIC_CRS,
234
+ :PJ_TYPE_GEOCENTRIC_CRS,
235
+ :PJ_TYPE_GEOGRAPHIC_CRS,
236
+ :PJ_TYPE_GEOGRAPHIC_2D_CRS,
237
+ :PJ_TYPE_GEOGRAPHIC_3D_CRS,
238
+ :PJ_TYPE_VERTICAL_CRS,
239
+ :PJ_TYPE_PROJECTED_CRS,
240
+ :PJ_TYPE_COMPOUND_CRS,
241
+ :PJ_TYPE_TEMPORAL_CRS,
242
+ :PJ_TYPE_ENGINEERING_CRS,
243
+ :PJ_TYPE_BOUND_CRS,
244
+ :PJ_TYPE_OTHER_CRS,
245
+
246
+ :PJ_TYPE_CONVERSION,
247
+ :PJ_TYPE_TRANSFORMATION,
248
+ :PJ_TYPE_CONCATENATED_OPERATION,
249
+ :PJ_TYPE_OTHER_COORDINATE_OPERATION,
250
+
251
+ :PJ_TYPE_TEMPORAL_DATUM,
252
+ :PJ_TYPE_ENGINEERING_DATUM,
253
+ :PJ_TYPE_PARAMETRIC_DATUM,
254
+
255
+ :PJ_TYPE_DERIVED_PROJECTED_CRS,
256
+
257
+ :PJ_TYPE_COORDINATE_METADATA)
258
+
259
+ PJ_PROJ_STRING_TYPE = enum(:PJ_PROJ_5,
260
+ :PJ_PROJ_4)
261
+
262
+ PJ_COORDINATE_SYSTEM_TYPE = enum(:PJ_CS_TYPE_UNKNOWN,
263
+ :PJ_CS_TYPE_CARTESIAN,
264
+ :PJ_CS_TYPE_ELLIPSOIDAL,
265
+ :PJ_CS_TYPE_VERTICAL,
266
+ :PJ_CS_TYPE_SPHERICAL,
267
+ :PJ_CS_TYPE_ORDINAL,
268
+ :PJ_CS_TYPE_PARAMETRIC,
269
+ :PJ_CS_TYPE_DATETIMETEMPORAL,
270
+ :PJ_CS_TYPE_TEMPORALCOUNT,
271
+ :PJ_CS_TYPE_TEMPORALMEASURE)
272
+
273
+ PJ_WKT_TYPE = enum(:PJ_WKT2_2015,
274
+ :PJ_WKT2_2015_SIMPLIFIED,
275
+ :PJ_WKT2_2019,
276
+ :PJ_WKT2_2018, # Deprecated alias for PJ_WKT2_2019
277
+ :PJ_WKT2_2018_SIMPLIFIED, # Deprecated alias for PJ_WKT2_2019
278
+ :PJ_WKT1_GDAL,
279
+ :PJ_WKT1_ESRI)
280
+
281
+ attach_function :proj_info, [], PJ_INFO.by_value
282
+ attach_function :proj_grid_info, [:string], PJ_GRID_INFO.by_value
283
+ attach_function :proj_init_info, [:string], PJ_INIT_INFO.by_value
284
+
285
+ attach_function :proj_pj_info, [:PJ], PJ_PROJ_INFO.by_value
286
+
287
+ # Contexts
288
+ attach_function :proj_context_create, [], :PJ_CONTEXT
289
+ attach_function :proj_context_destroy, [:PJ_CONTEXT], :PJ_CONTEXT
290
+
291
+ # Error handling
292
+ attach_function :proj_context_errno, [:PJ_CONTEXT], :int
293
+ attach_function :proj_errno, [:PJ], :int
294
+ attach_function :proj_errno_set, [:PJ, :int], :int
295
+ attach_function :proj_errno_reset, [:PJ], :int
296
+ attach_function :proj_errno_restore, [:PJ, :int], :int
297
+
298
+ # Manage the transformation definition object PJ
299
+ attach_function :proj_create, [:PJ_CONTEXT, :string], :PJ
300
+ attach_function :proj_create_argv, [:PJ_CONTEXT, :int, :pointer], :PJ
301
+ attach_function :proj_create_crs_to_crs, [:PJ_CONTEXT, :string, :string, :PJ_AREA], :PJ
302
+ attach_function :proj_destroy, [:PJ], :PJ
303
+
304
+ attach_function :proj_trans, [:PJ, PJ_DIRECTION, PJ_COORD.by_value], PJ_COORD.by_value
305
+ attach_function :proj_trans_generic, [:PJ, PJ_DIRECTION, :pointer, :size_t, :size_t, :pointer, :size_t, :size_t, :pointer, :size_t, :size_t, :pointer, :size_t, :size_t], :size_t
306
+ attach_function :proj_trans_array, [:PJ, PJ_DIRECTION, :size_t, :pointer], :int
307
+ attach_function :proj_roundtrip, [:PJ, PJ_DIRECTION, :int, PJ_COORD.by_ref], :double
308
+ attach_function :proj_factors, [:PJ, PJ_COORD.by_value], PJ_FACTORS.by_value
309
+
310
+ # Get lists of operations, ellipsoids, units and prime meridians
311
+ attach_function :proj_list_operations, [], :pointer #PJ_LIST
312
+ attach_function :proj_list_ellps, [], :pointer #PJ_ELLPS
313
+ attach_function :proj_list_units, [], :pointer #PJ_UNITS
314
+ attach_function :proj_list_prime_meridians, [], :pointer #PJ_PRIME_MERIDIANS
315
+
316
+ # Degrees/radians
317
+ attach_function :proj_torad, [:double], :double
318
+ attach_function :proj_todeg, [:double], :double
319
+ attach_function :proj_dmstor, [:string, :pointer], :double
320
+ attach_function :proj_rtodms, [:pointer, :double, :int, :int], :string
321
+
322
+ attach_function :proj_angular_input, [:PJ, PJ_DIRECTION], :int
323
+ attach_function :proj_angular_output, [:PJ, PJ_DIRECTION], :int
324
+
325
+ # Distances
326
+ attach_function :proj_lp_dist, [:PJ, PJ_COORD.by_value, PJ_COORD.by_value], :double
327
+ attach_function :proj_lpz_dist, [:PJ, PJ_COORD.by_value, PJ_COORD.by_value], :double
328
+ attach_function :proj_geod, [:PJ, PJ_COORD.by_value, PJ_COORD.by_value], PJ_COORD.by_value
329
+ attach_function :proj_xy_dist, [PJ_COORD.by_value, PJ_COORD.by_value], :double
330
+ attach_function :proj_xyz_dist, [PJ_COORD.by_value, PJ_COORD.by_value], :double
331
+ end
301
332
  end
data/lib/api/api_5_1.rb CHANGED
@@ -1,7 +1,7 @@
1
- module Proj
2
- module Api
3
- attach_function :proj_log_level, [:PJ_CONTEXT, :PJ_LOG_LEVEL], :PJ_LOG_LEVEL
4
- callback :pj_log_function, [:pointer, :int, :string], :void
5
- attach_function :proj_log_func, [:PJ_CONTEXT, :pointer, :pj_log_function], :void
6
- end
1
+ module Proj
2
+ module Api
3
+ attach_function :proj_log_level, [:PJ_CONTEXT, PJ_LOG_LEVEL], PJ_LOG_LEVEL
4
+ callback :pj_log_function, [:pointer, :int, :string], :void
5
+ attach_function :proj_log_func, [:PJ_CONTEXT, :pointer, :pj_log_function], :void
6
+ end
7
7
  end