proj4rb 2.2.1 → 2.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ChangeLog +66 -61
- data/Gemfile +4 -4
- data/Rakefile +27 -27
- data/lib/api/api.rb +110 -83
- data/lib/api/api_4_9.rb +30 -30
- data/lib/api/api_5_0.rb +300 -300
- data/lib/api/api_5_1.rb +6 -6
- data/lib/api/api_5_2.rb +4 -4
- data/lib/api/api_6_0.rb +41 -42
- data/lib/api/api_6_1.rb +4 -4
- data/lib/api/api_6_2.rb +6 -5
- data/lib/area.rb +32 -32
- data/lib/config.rb +69 -69
- data/lib/context.rb +102 -102
- data/lib/coordinate.rb +197 -197
- data/lib/crs.rb +204 -204
- data/lib/ellipsoid.rb +41 -41
- data/lib/error.rb +17 -17
- data/lib/operation.rb +42 -42
- data/lib/pj_object.rb +80 -80
- data/lib/point.rb +72 -72
- data/lib/prime_meridian.rb +39 -39
- data/lib/proj.rb +30 -30
- data/lib/projection.rb +206 -206
- data/lib/transformation.rb +60 -60
- data/lib/unit.rb +53 -53
- data/proj4rb.gemspec +32 -32
- data/test/abstract_test.rb +7 -7
- data/test/context_test.rb +81 -81
- data/test/coordinate_test.rb +34 -34
- data/test/crs_test.rb +372 -372
- data/test/ellipsoid_test.rb +34 -34
- data/test/operation_test.rb +29 -29
- data/test/prime_meridians_test.rb +33 -33
- data/test/proj_test.rb +16 -16
- data/test/projection_test.rb +223 -223
- data/test/transformation_test.rb +67 -67
- data/test/unit_test.rb +47 -47
- metadata +2 -2
data/lib/api/api_5_0.rb
CHANGED
@@ -1,301 +1,301 @@
|
|
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 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
|
301
301
|
end
|