proj4rb 4.1.0 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +98 -0
  3. data/Gemfile +4 -4
  4. data/README.md +53 -0
  5. data/lib/api/proj.rb +750 -0
  6. data/lib/api/proj_experimental.rb +7 -0
  7. data/lib/api/proj_ffi.rb +47 -0
  8. data/lib/api/proj_version.rb +26 -0
  9. data/lib/examples/axis_order_normalization.rb +13 -0
  10. data/lib/examples/batch_transformation.rb +25 -0
  11. data/lib/examples/context_logging.rb +26 -0
  12. data/lib/examples/crs_identification.rb +18 -0
  13. data/lib/examples/database_query.rb +27 -0
  14. data/lib/examples/geodetic_distance.rb +38 -0
  15. data/lib/examples/geodetic_to_projected.rb +18 -0
  16. data/lib/examples/operation_factory_context.rb +19 -0
  17. data/lib/examples/pipeline_operator.rb +21 -0
  18. data/lib/examples/promote_demote_3d.rb +23 -0
  19. data/lib/examples/serialization_formats.rb +17 -0
  20. data/lib/examples/transform_bounds.rb +18 -0
  21. data/lib/examples/transformation_with_area.rb +18 -0
  22. data/lib/proj/area.rb +74 -74
  23. data/lib/proj/axis_info.rb +44 -44
  24. data/lib/proj/bounds.rb +22 -0
  25. data/lib/proj/bounds3d.rb +45 -0
  26. data/lib/proj/context.rb +57 -23
  27. data/lib/proj/conversion.rb +94 -91
  28. data/lib/proj/coordinate.rb +304 -281
  29. data/lib/proj/coordinate_metadata.rb +38 -0
  30. data/lib/proj/coordinate_operation_mixin.rb +464 -381
  31. data/lib/proj/coordinate_system.rb +143 -137
  32. data/lib/proj/crs.rb +688 -672
  33. data/lib/proj/crs_info.rb +47 -47
  34. data/lib/proj/database.rb +310 -305
  35. data/lib/proj/datum.rb +32 -32
  36. data/lib/proj/datum_ensemble.rb +34 -34
  37. data/lib/proj/domain.rb +82 -0
  38. data/lib/proj/ellipsoid.rb +77 -77
  39. data/lib/proj/error.rb +7 -8
  40. data/lib/proj/file_api_callbacks.rb +165 -0
  41. data/lib/proj/grid.rb +121 -121
  42. data/lib/proj/grid_cache.rb +65 -64
  43. data/lib/proj/grid_info.rb +19 -19
  44. data/lib/proj/life_span.rb +21 -0
  45. data/lib/proj/network_api_callbacks.rb +86 -0
  46. data/lib/proj/operation.rb +66 -42
  47. data/lib/proj/operation_factory_context.rb +4 -2
  48. data/lib/proj/options.rb +41 -0
  49. data/lib/proj/parameter.rb +37 -37
  50. data/lib/proj/parameters.rb +106 -107
  51. data/lib/proj/pj_axis_description.rb +26 -0
  52. data/lib/proj/pj_object.rb +602 -670
  53. data/lib/proj/pj_objects.rb +45 -45
  54. data/lib/proj/pj_param_description.rb +28 -0
  55. data/lib/proj/prime_meridian.rb +65 -65
  56. data/lib/proj/projection.rb +1771 -698
  57. data/lib/proj/session.rb +2 -0
  58. data/lib/proj/transformation.rb +102 -102
  59. data/lib/proj/unit.rb +81 -108
  60. data/lib/proj.rb +10 -3
  61. data/lib/proj4.rb +5 -5
  62. data/proj4rb.gemspec +10 -5
  63. data/test/abstract_test.rb +7 -28
  64. data/test/context_test.rb +210 -172
  65. data/test/context_validation_test.rb +11 -0
  66. data/test/conversion_test.rb +376 -368
  67. data/test/coordinate_metadata_test.rb +34 -0
  68. data/test/coordinate_system_test.rb +162 -144
  69. data/test/coordinate_test.rb +289 -34
  70. data/test/crs_test.rb +1112 -1072
  71. data/test/database_test.rb +407 -359
  72. data/test/datum_ensemble_test.rb +64 -64
  73. data/test/datum_test.rb +61 -54
  74. data/test/domain_test.rb +72 -0
  75. data/test/ellipsoid_test.rb +80 -80
  76. data/test/examples_test.rb +149 -0
  77. data/test/file_api_example.rb +58 -0
  78. data/test/file_api_test.rb +74 -66
  79. data/test/grid_cache_test.rb +72 -72
  80. data/test/grid_test.rb +126 -141
  81. data/test/network_api_example.rb +48 -0
  82. data/test/network_api_test.rb +33 -45
  83. data/test/operation_factory_context_test.rb +225 -201
  84. data/test/operation_test.rb +40 -29
  85. data/test/options_test.rb +17 -0
  86. data/test/parameters_test.rb +86 -40
  87. data/test/pj_object_test.rb +221 -179
  88. data/test/prime_meridian_test.rb +75 -75
  89. data/test/proj_test.rb +58 -58
  90. data/test/projection_test.rb +680 -650
  91. data/test/session_test.rb +78 -77
  92. data/test/transformation_test.rb +238 -210
  93. data/test/unit_test.rb +114 -76
  94. metadata +45 -31
  95. data/ChangeLog +0 -89
  96. data/README.rdoc +0 -207
  97. data/lib/api/api.rb +0 -117
  98. data/lib/api/api_5_0.rb +0 -338
  99. data/lib/api/api_5_1.rb +0 -7
  100. data/lib/api/api_5_2.rb +0 -5
  101. data/lib/api/api_6_0.rb +0 -146
  102. data/lib/api/api_6_1.rb +0 -5
  103. data/lib/api/api_6_2.rb +0 -10
  104. data/lib/api/api_6_3.rb +0 -6
  105. data/lib/api/api_7_0.rb +0 -69
  106. data/lib/api/api_7_1.rb +0 -73
  107. data/lib/api/api_7_2.rb +0 -14
  108. data/lib/api/api_8_0.rb +0 -6
  109. data/lib/api/api_8_1.rb +0 -24
  110. data/lib/api/api_8_2.rb +0 -6
  111. data/lib/api/api_9_1.rb +0 -7
  112. data/lib/api/api_9_2.rb +0 -9
  113. data/lib/api/api_experimental.rb +0 -201
  114. data/lib/proj/file_api.rb +0 -166
  115. data/lib/proj/network_api.rb +0 -92
data/lib/api/api.rb DELETED
@@ -1,117 +0,0 @@
1
- require 'rbconfig'
2
- require 'ffi'
3
-
4
- module Proj
5
- module Api
6
- extend FFI::Library
7
-
8
- # List of knows PROJ library versions
9
- #
10
- # @return [Array<String>]
11
- def self.library_versions
12
- ["25", # 9.2
13
- "9_1", # 9.1
14
- "22", # 8.0 and 8.1
15
- "19", # 7.x
16
- "17", # 6.1 *and* 6.2
17
- "15", # 6.0
18
- "14", # 5.2
19
- "13", # 5.0
20
- "12", # 4.9
21
- "11"] # 4.9
22
- end
23
-
24
- # Search paths to use when looking for PROJ library
25
- #
26
- # @return [Array<String>]
27
- def self.search_paths
28
- result = case RbConfig::CONFIG['host_os']
29
- when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
30
- self.windows_search_paths
31
- when /darwin|mac os/
32
- self.macos_search_paths
33
- else
34
- self.linux_search_paths
35
- end
36
-
37
- # Try libproj as catch all
38
- result << 'libproj'
39
- result
40
- end
41
-
42
- # Windows search paths for PROJ library
43
- #
44
- # @return [Array<String>]
45
- def self.windows_search_paths
46
- self.library_versions.map do |version|
47
- ["libproj-#{version}", "libproj_#{version}"]
48
- end.flatten
49
- end
50
-
51
- # Linux search paths for PROJ library
52
- #
53
- # @return [Array<String>]
54
- def self.linux_search_paths
55
- self.library_versions.map do |version|
56
- "libproj.so.#{version}"
57
- end
58
- end
59
-
60
- # MacOS search paths for PROJ library
61
- #
62
- # @return [Array<String>]
63
- def self.macos_search_paths
64
- # On MacOS only support HomeBrew since the MacPort is unsupported and ancient (5.2).
65
- self.library_versions.map do |version|
66
- "libproj.#{version}.dylib"
67
- end
68
- end
69
-
70
- # Load PROJ library
71
- #
72
- # @return [FFI::DynamicLibrary]
73
- def self.load_library
74
- if ENV["PROJ_LIB_PATH"]
75
- ffi_lib ENV["PROJ_LIB_PATH"]
76
- else
77
- ffi_lib self.search_paths
78
- end
79
-
80
- ffi_libraries.first
81
- end
82
-
83
- # Load API files based on PROJ version
84
- #
85
- # @return [nil]
86
- def self.load_api
87
- # First load the base 5.0 api so we can determine the Proj Version
88
- require_relative './api_5_0'
89
- Api.const_set('PROJ_VERSION', Gem::Version.new(self.proj_info[:version]))
90
-
91
- # Now load the rest of the apis based on the proj version
92
- versions = ['5.1.0', '5.2.0',
93
- '6.0.0', '6.1.0', '6.2.0', '6.3.0',
94
- '7.0.0', '7.1.0', '7.2.0',
95
- '8.0.0', '8.1.0', '8.2.0',
96
- '9.1.0', '9.2.0']
97
-
98
- versions.each do |version|
99
- api_version = Gem::Version.new(version)
100
-
101
- if PROJ_VERSION >= api_version
102
- require_relative "./api_#{api_version.segments[0]}_#{api_version.segments[1]}"
103
- end
104
- end
105
-
106
- # Add in the experimental api
107
- require_relative "./api_experimental"
108
- end
109
-
110
- # Load the library
111
- load_library
112
-
113
- # Load the api
114
- load_api
115
- end
116
- end
117
-
data/lib/api/api_5_0.rb DELETED
@@ -1,338 +0,0 @@
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
-
32
- class PJ_ELLPS < FFI::Struct
33
- layout :id, :string, # ellipse keyword name
34
- :major, :string, # a= value
35
- :ell, :string, # elliptical parameter
36
- :name, :string # comments
37
- end
38
-
39
- class PJ_UNITS < FFI::Struct
40
- layout :id, :string, # units keyword
41
- :to_meter, :string, # multiply by value to get meters
42
- :name, :string, # comments
43
- :factor, :double # to_meter factor in actual numbers
44
- end
45
-
46
- class PJ_PRIME_MERIDIANS < FFI::Struct
47
- layout :id, :string, # prime meridian keyword
48
- :defn, :string # offset from greenwich in DMS format.
49
- end
50
-
51
- # Geodetic, mostly spatiotemporal coordinate types
52
- class PJ_XYZT < FFI::Struct
53
- layout :x, :double,
54
- :y, :double,
55
- :z, :double,
56
- :t, :double
57
- end
58
-
59
- class PJ_UVWT < FFI::Struct
60
- layout :u, :double,
61
- :v, :double,
62
- :w, :double,
63
- :t, :double
64
- end
65
-
66
- class PJ_LPZT < FFI::Struct
67
- layout :lam, :double,
68
- :phi, :double,
69
- :z, :double,
70
- :t, :double
71
- end
72
-
73
- # Rotations: omega, phi, kappa
74
- class PJ_OPK < FFI::Struct
75
- layout :o, :double,
76
- :p, :double,
77
- :k, :double
78
- end
79
-
80
- # East, North, Up
81
- class PJ_ENU < FFI::Struct
82
- layout :e, :double,
83
- :n, :double,
84
- :u, :double
85
- end
86
-
87
- # Geodesic length, fwd azi, rev azi
88
- class PJ_GEOD < FFI::Struct
89
- layout :s, :double,
90
- :a1, :double,
91
- :a2, :double
92
- end
93
-
94
- # Classic proj.4 pair/triplet types - moved into the PJ_ name space.
95
- class PJ_UV < FFI::Struct
96
- layout :u, :double,
97
- :v, :double
98
- end
99
-
100
- class PJ_XY < FFI::Struct
101
- layout :x, :double,
102
- :y, :double
103
- end
104
-
105
- class PJ_LP < FFI::Struct
106
- layout :lam, :double,
107
- :phi, :double
108
- end
109
-
110
- class PJ_XYZ < FFI::Struct
111
- layout :x, :double,
112
- :y, :double,
113
- :z, :double
114
- end
115
-
116
- class PJ_UVW < FFI::Struct
117
- layout :u, :double,
118
- :v, :double,
119
- :w, :double
120
- end
121
-
122
- class PJ_LPZ < FFI::Struct
123
- layout :lam, :double,
124
- :phi, :double,
125
- :z, :double
126
- end
127
-
128
- class PJ_COORD < FFI::Union
129
- layout :v, [:double, 4],
130
- :xyzt, PJ_XYZT,
131
- :uvwt, PJ_UVWT,
132
- :lpzt, PJ_LPZT,
133
- :geod, PJ_GEOD,
134
- :opk, PJ_OPK,
135
- :enu, PJ_ENU,
136
- :xyz, PJ_XYZ,
137
- :uvw, PJ_UVW,
138
- :lpz, PJ_LPZ,
139
- :xy, PJ_XY,
140
- :uv, PJ_UV,
141
- :lp, PJ_LP
142
-
143
- def eql?(other)
144
- self[:v][0] == other[:v][0] &&
145
- self[:v][1] == other[:v][1] &&
146
- self[:v][2] == other[:v][2] &&
147
- self[:v][3] == other[:v][3]
148
- end
149
-
150
- def ==(other)
151
- self.eql?(other)
152
- end
153
- end
154
-
155
- class PJ_INFO < FFI::Struct
156
- layout :major, :int, # Major release number
157
- :minor, :int, # Minor release number
158
- :patch, :int, # Patch level
159
- :release, :string, # Release info. Version + date
160
- :version, :string, # Full version number
161
- :searchpath, :string, # Paths where init and grid files are looked for. Paths are separated by
162
- # semi-colons on Windows, and colons on non-Windows platforms.
163
- :paths, :pointer,
164
- :path_count, :size_t
165
- end
166
-
167
- class PJ_PROJ_INFO < FFI::Struct
168
- layout :id, :string, # Name of the projection in question
169
- :description, :string, # Description of the projection
170
- :definition, :string, # Projection definition
171
- :has_inverse, :int, # 1 if an inverse mapping exists, 0 otherwise
172
- :accuracy, :double # Expected accuracy of the transformation. -1 if unknown.
173
-
174
- def to_s
175
- "<#{self.class.name} id: #{self[:id]}, description: #{self[:description]}, definition: #{self[:definition]}, has_inverse: #{self[:has_inverse]} accuracy: #{self[:accuracy]}"
176
- end
177
- end
178
-
179
- class PJ_GRID_INFO < FFI::Struct
180
- layout :gridname, [:char, 32], # name of grid
181
- :filename, [:char, 260], # full path to grid
182
- :format, [:char, 8], # file format of grid
183
- :lowerleft, PJ_LP, # Coordinates of lower left corner
184
- :upperright, PJ_LP, # Coordinates of upper right corner
185
- :n_lon, :int, # Grid size
186
- :n_lat, :int, # Grid size
187
- :cs_lon, :double, # Cell size of grid
188
- :cs_lat, :double # Cell size of grid
189
- end
190
-
191
- class PJ_INIT_INFO < FFI::Struct
192
- layout :name, [:string, 32], # name init file
193
- :filename, [:string, 260], # full path to the init file
194
- :version, [:string, 32], # version of the init file
195
- :origin, [:string, 32], # origin of the file, e.g. EPSG
196
- :lastupdate, [:string, 16] # Date of last update in YYYY-MM-DD format
197
- end
198
-
199
- # @return [Symbol]
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
- # @return [Symbol]
210
- PJ_DIRECTION = enum(:PJ_FWD, 1, # Forward
211
- :PJ_IDENT, 0, # Do nothing
212
- :PJ_INV, -1) # Inverse
213
-
214
- # Object category
215
- # @return [Symbol]
216
- PJ_CATEGORY = enum(:PJ_CATEGORY_ELLIPSOID,
217
- :PJ_CATEGORY_PRIME_MERIDIAN,
218
- :PJ_CATEGORY_DATUM,
219
- :PJ_CATEGORY_CRS,
220
- :PJ_CATEGORY_COORDINATE_OPERATION,
221
- :PJ_CATEGORY_DATUM_ENSEMBLE)
222
-
223
- # @return [Symbol]
224
- PJ_TYPE = enum(:PJ_TYPE_UNKNOWN,
225
- :PJ_TYPE_ELLIPSOID,
226
- :PJ_TYPE_PRIME_MERIDIAN,
227
- :PJ_TYPE_GEODETIC_REFERENCE_FRAME,
228
- :PJ_TYPE_DYNAMIC_GEODETIC_REFERENCE_FRAME,
229
- :PJ_TYPE_VERTICAL_REFERENCE_FRAME,
230
- :PJ_TYPE_DYNAMIC_VERTICAL_REFERENCE_FRAME,
231
- :PJ_TYPE_DATUM_ENSEMBLE,
232
-
233
- # Abstract type, not returned by proj_get_type()
234
- :PJ_TYPE_CRS,
235
-
236
- :PJ_TYPE_GEODETIC_CRS,
237
- :PJ_TYPE_GEOCENTRIC_CRS,
238
- :PJ_TYPE_GEOGRAPHIC_CRS,
239
- :PJ_TYPE_GEOGRAPHIC_2D_CRS,
240
- :PJ_TYPE_GEOGRAPHIC_3D_CRS,
241
- :PJ_TYPE_VERTICAL_CRS,
242
- :PJ_TYPE_PROJECTED_CRS,
243
- :PJ_TYPE_COMPOUND_CRS,
244
- :PJ_TYPE_TEMPORAL_CRS,
245
- :PJ_TYPE_ENGINEERING_CRS,
246
- :PJ_TYPE_BOUND_CRS,
247
- :PJ_TYPE_OTHER_CRS,
248
-
249
- :PJ_TYPE_CONVERSION,
250
- :PJ_TYPE_TRANSFORMATION,
251
- :PJ_TYPE_CONCATENATED_OPERATION,
252
- :PJ_TYPE_OTHER_COORDINATE_OPERATION,
253
-
254
- :PJ_TYPE_TEMPORAL_DATUM,
255
- :PJ_TYPE_ENGINEERING_DATUM,
256
- :PJ_TYPE_PARAMETRIC_DATUM,
257
-
258
- :PJ_TYPE_DERIVED_PROJECTED_CRS,
259
-
260
- :PJ_TYPE_COORDINATE_METADATA)
261
-
262
- # @return [Symbol]
263
- PJ_PROJ_STRING_TYPE = enum(:PJ_PROJ_5,
264
- :PJ_PROJ_4)
265
-
266
- # @return [Symbol]
267
- PJ_COORDINATE_SYSTEM_TYPE = enum(:PJ_CS_TYPE_UNKNOWN,
268
- :PJ_CS_TYPE_CARTESIAN,
269
- :PJ_CS_TYPE_ELLIPSOIDAL,
270
- :PJ_CS_TYPE_VERTICAL,
271
- :PJ_CS_TYPE_SPHERICAL,
272
- :PJ_CS_TYPE_ORDINAL,
273
- :PJ_CS_TYPE_PARAMETRIC,
274
- :PJ_CS_TYPE_DATETIMETEMPORAL,
275
- :PJ_CS_TYPE_TEMPORALCOUNT,
276
- :PJ_CS_TYPE_TEMPORALMEASURE)
277
-
278
- # @return [Symbol]
279
- PJ_WKT_TYPE = enum(:PJ_WKT2_2015,
280
- :PJ_WKT2_2015_SIMPLIFIED,
281
- :PJ_WKT2_2019,
282
- :PJ_WKT2_2018, # Deprecated alias for PJ_WKT2_2019
283
- :PJ_WKT2_2018_SIMPLIFIED, # Deprecated alias for PJ_WKT2_2019
284
- :PJ_WKT1_GDAL,
285
- :PJ_WKT1_ESRI)
286
-
287
- attach_function :proj_info, [], PJ_INFO.by_value
288
- attach_function :proj_grid_info, [:string], PJ_GRID_INFO.by_value
289
- attach_function :proj_init_info, [:string], PJ_INIT_INFO.by_value
290
-
291
- attach_function :proj_pj_info, [:PJ], PJ_PROJ_INFO.by_value
292
-
293
- # Contexts
294
- attach_function :proj_context_create, [], :PJ_CONTEXT
295
- attach_function :proj_context_destroy, [:PJ_CONTEXT], :PJ_CONTEXT
296
-
297
- # Error handling
298
- attach_function :proj_context_errno, [:PJ_CONTEXT], :int
299
- attach_function :proj_errno, [:PJ], :int
300
- attach_function :proj_errno_set, [:PJ, :int], :int
301
- attach_function :proj_errno_reset, [:PJ], :int
302
- attach_function :proj_errno_restore, [:PJ, :int], :int
303
-
304
- # Manage the transformation definition object PJ
305
- attach_function :proj_create, [:PJ_CONTEXT, :string], :PJ
306
- attach_function :proj_create_argv, [:PJ_CONTEXT, :int, :pointer], :PJ
307
- attach_function :proj_create_crs_to_crs, [:PJ_CONTEXT, :string, :string, :PJ_AREA], :PJ
308
- attach_function :proj_destroy, [:PJ], :PJ
309
-
310
- attach_function :proj_trans, [:PJ, PJ_DIRECTION, PJ_COORD.by_value], PJ_COORD.by_value
311
- 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
312
- attach_function :proj_trans_array, [:PJ, PJ_DIRECTION, :size_t, :pointer], :int
313
- attach_function :proj_roundtrip, [:PJ, PJ_DIRECTION, :int, PJ_COORD.by_ref], :double
314
- attach_function :proj_factors, [:PJ, PJ_COORD.by_value], PJ_FACTORS.by_value
315
-
316
- # Get lists of operations, ellipsoids, units and prime meridians
317
- attach_function :proj_list_operations, [], :pointer #PJ_LIST
318
- attach_function :proj_list_ellps, [], :pointer #PJ_ELLPS
319
- attach_function :proj_list_units, [], :pointer #PJ_UNITS
320
- attach_function :proj_list_prime_meridians, [], :pointer #PJ_PRIME_MERIDIANS
321
-
322
- # Degrees/radians
323
- attach_function :proj_torad, [:double], :double
324
- attach_function :proj_todeg, [:double], :double
325
- attach_function :proj_dmstor, [:string, :pointer], :double
326
- attach_function :proj_rtodms, [:pointer, :double, :int, :int], :string
327
-
328
- attach_function :proj_angular_input, [:PJ, PJ_DIRECTION], :int
329
- attach_function :proj_angular_output, [:PJ, PJ_DIRECTION], :int
330
-
331
- # Distances
332
- attach_function :proj_lp_dist, [:PJ, PJ_COORD.by_value, PJ_COORD.by_value], :double
333
- attach_function :proj_lpz_dist, [:PJ, PJ_COORD.by_value, PJ_COORD.by_value], :double
334
- attach_function :proj_geod, [:PJ, PJ_COORD.by_value, PJ_COORD.by_value], PJ_COORD.by_value
335
- attach_function :proj_xy_dist, [PJ_COORD.by_value, PJ_COORD.by_value], :double
336
- attach_function :proj_xyz_dist, [PJ_COORD.by_value, PJ_COORD.by_value], :double
337
- end
338
- end
data/lib/api/api_5_1.rb DELETED
@@ -1,7 +0,0 @@
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
- end
data/lib/api/api_5_2.rb DELETED
@@ -1,5 +0,0 @@
1
- module Proj
2
- module Api
3
- attach_function :proj_errno_string, [:int], :string
4
- end
5
- end
data/lib/api/api_6_0.rb DELETED
@@ -1,146 +0,0 @@
1
- module Proj
2
- module Api
3
- # Comparison criteria
4
- # @return [Symbol]
5
- PJ_COMPARISON_CRITERION = enum(:PJ_COMP_STRICT, # All properties are identical
6
- :PJ_COMP_EQUIVALENT, # The objects are equivalent for the purpose of coordinate operations. They can differ by the name of their objects, identifiers, other metadata. Parameters may be expressed in different units, provided that the value is (with some tolerance) the same once expressed in a common unit.
7
- :PJ_COMP_EQUIVALENT_EXCEPT_AXIS_ORDER_GEOGCRS) # Same as EQUIVALENT, relaxed with an exception that the axis order of the base CRS of a DerivedCRS/ProjectedCRS or the axis order of a GeographicCRS is ignored. Only to be used with DerivedCRS/ProjectedCRS/GeographicCRS
8
-
9
- #Guessed WKT "dialect"
10
- # @return [Symbol]
11
- PJ_GUESSED_WKT_DIALECT = enum(:PJ_GUESSED_WKT2_2019,
12
- :PJ_GUESSED_WKT2_2018,
13
- :PJ_GUESSED_WKT2_2015,
14
- :PJ_GUESSED_WKT1_GDAL,
15
- :PJ_GUESSED_WKT1_ESRI,
16
- :PJ_GUESSED_NOT_WKT)
17
-
18
- # Base methods
19
- attach_function :proj_clone, [:PJ_CONTEXT, :PJ], :PJ
20
- attach_function :proj_get_name, [:PJ], :string
21
- attach_function :proj_get_id_auth_name, [:PJ, :int], :string
22
- attach_function :proj_get_id_code, [:PJ, :int], :string
23
- attach_function :proj_get_remarks, [:PJ], :string
24
- attach_function :proj_get_scope, [:PJ], :string
25
- attach_function :proj_get_type, [:PJ], PJ_TYPE
26
- attach_function :proj_is_crs, [:PJ], :bool
27
- attach_function :proj_is_equivalent_to, [:PJ, :PJ, PJ_COMPARISON_CRITERION], :int
28
- attach_function :proj_is_deprecated, [:PJ], :int
29
- attach_function :proj_get_source_crs, [:PJ_CONTEXT, :PJ], :PJ
30
- attach_function :proj_get_target_crs, [:PJ_CONTEXT, :PJ], :PJ
31
-
32
- # Area
33
- attach_function :proj_area_create, [], :PJ_AREA
34
- attach_function :proj_area_set_bbox, [:PJ_AREA, :double, :double, :double, :double], :void
35
- attach_function :proj_get_area_of_use, [:PJ_CONTEXT, :PJ, :pointer, :pointer, :pointer, :pointer, :pointer], :bool
36
- attach_function :proj_area_destroy, [:PJ_AREA], :void
37
-
38
- # Export to various formats
39
- attach_function :proj_as_wkt, [:PJ_CONTEXT, :PJ, PJ_WKT_TYPE, :pointer], :string
40
- attach_function :proj_as_proj_string, [:PJ_CONTEXT, :PJ, PJ_PROJ_STRING_TYPE, :pointer], :string
41
-
42
- # String List
43
- typedef :pointer, :PROJ_STRING_LIST
44
- attach_function :proj_string_list_destroy, [:PROJ_STRING_LIST], :void
45
-
46
- # ----- Object List
47
- typedef :pointer, :PJ_OBJ_LIST
48
-
49
- attach_function :proj_create_from_name, [:PJ_CONTEXT, :string, :string, :pointer, :size_t, :int, :size_t, :string], :PJ_OBJ_LIST
50
- attach_function :proj_get_non_deprecated, [:PJ_CONTEXT, :PJ], :PJ_OBJ_LIST
51
- attach_function :proj_identify, [:PJ_CONTEXT, :PJ, :string, :pointer, :pointer], :PJ_OBJ_LIST
52
- attach_function :proj_list_get_count, [:PJ_OBJ_LIST], :int
53
- attach_function :proj_list_get, [:PJ_CONTEXT, :PJ_OBJ_LIST, :int], :PJ
54
- attach_function :proj_list_destroy, [:PJ_OBJ_LIST], :void
55
-
56
- callback :proj_file_finder, [:PJ_CONTEXT, :string, :pointer], :pointer
57
- attach_function :proj_context_set_file_finder, [:PJ_CONTEXT, :proj_file_finder, :pointer], :void
58
- attach_function :proj_context_set_search_paths, [:PJ_CONTEXT, :int, :pointer], :void
59
-
60
- attach_function :proj_list_angular_units, [], :pointer #PJ_UNITS
61
-
62
- # Contains description of a CRS
63
- class PROJ_CRS_INFO < FFI::Struct
64
- fields = [:auth_name, :string, # Authority name
65
- :code, :string, # Object code
66
- :name, :string, # Object name
67
- :type, PJ_TYPE, # Object type
68
- :deprecated, :int, # Whether the object is deprecated
69
- :bbox_valid, :int, # Whether bbox values in degrees are valid
70
- :west_lon_degree, :double, # Western-most longitude of the area of use, in degrees.
71
- :south_lat_degree, :double, # Southern-most latitude of the area of use, in degrees.
72
- :east_lon_degree, :double, # Eastern-most longitude of the area of use, in degrees.
73
- :north_lat_degree, :double, # Northern-most latitude of the area of use, in degrees.
74
- :area_name, :string, # Name of the area of use
75
- :projection_method_name, :string] # Name of the projection method for a projected CRS. Might be NULL even for projected CRS in some cases.
76
-
77
- if Api::PROJ_VERSION >= Gem::Version.new('8.1.0')
78
- fields += [:celestial_body_name, :string] # Name of the celestial body of the CRS (e.g. "Earth")
79
- end
80
- layout(*fields)
81
- end
82
-
83
- attach_function :proj_crs_info_list_destroy, [:pointer], :void
84
-
85
- # Structure describing optional parameters for proj_get_crs_list
86
- class PROJ_CRS_LIST_PARAMETERS < FFI::Struct
87
- fields = [:types, :pointer, # Array of allowed object types. Should be nil if all types are allowed
88
- :types_count, :size_t, # Size of types. Should be 0 if all types are allowed
89
- :crs_area_of_use_contains_bbox, :int, # If TRUE and bbox_valid == TRUE, then only CRS whose area of use entirely contains the specified bounding box will be returned. If FALSE and bbox_valid == TRUE, then only CRS whose area of use intersects the specified bounding box will be returned
90
- :bbox_valid, :int, # To set to TRUE so that west_lon_degree, south_lat_degree, east_lon_degree and north_lat_degree fields are taken into account
91
- :west_lon_degree, :double, # Western-most longitude of the area of use, in degrees.
92
- :south_lat_degree, :double, # Southern-most latitude of the area of use, in degrees.
93
- :east_lon_degree, :double, # Eastern-most longitude of the area of use, in degrees.
94
- :north_lat_degree, :double,# Northern-most latitude of the area of use, in degrees.
95
- :allow_deprecated, :int] # Whether deprecated objects are allowed. Default to False
96
-
97
- if Api::PROJ_VERSION >= Gem::Version.new('8.1.0')
98
- fields += [:celestial_body_name, :pointer] #Name of the celestial body of the CRS (e.g. "Earth")
99
- end
100
- layout(*fields)
101
- end
102
-
103
- attach_function :proj_get_crs_list_parameters_create, [], :pointer
104
- attach_function :proj_get_crs_list_parameters_destroy, [:pointer], :void
105
-
106
- # Database functions
107
- attach_function :proj_context_set_database_path, [:PJ_CONTEXT, :string, :pointer, :pointer], :int
108
- attach_function :proj_context_get_database_path, [:PJ_CONTEXT], :string
109
- attach_function :proj_context_get_database_metadata, [:PJ_CONTEXT, :string], :string
110
- attach_function :proj_get_authorities_from_database, [:PJ_CONTEXT], :PROJ_STRING_LIST
111
- attach_function :proj_get_codes_from_database, [:PJ_CONTEXT, :string, PJ_TYPE, :int], :PROJ_STRING_LIST
112
- attach_function :proj_get_crs_info_list_from_database, [:PJ_CONTEXT, :string, PROJ_CRS_LIST_PARAMETERS, :pointer], PROJ_CRS_INFO
113
- attach_function :proj_uom_get_info_from_database, [:PJ_CONTEXT, :string, :string, :pointer, :pointer, :pointer], :int
114
-
115
- # CRS methods
116
- attach_function :proj_crs_get_geodetic_crs, [:PJ_CONTEXT, :PJ], :PJ
117
- attach_function :proj_crs_get_horizontal_datum, [:PJ_CONTEXT, :PJ], :PJ
118
- attach_function :proj_crs_get_sub_crs, [:PJ_CONTEXT, :PJ, :int], :PJ
119
- attach_function :proj_crs_get_datum, [:PJ_CONTEXT, :PJ], :PJ
120
- attach_function :proj_crs_get_coordinate_system, [:PJ_CONTEXT, :PJ], :PJ
121
- attach_function :proj_cs_get_type, [:PJ_CONTEXT, :PJ], PJ_COORDINATE_SYSTEM_TYPE
122
- attach_function :proj_cs_get_axis_count, [:PJ_CONTEXT, :PJ], :int
123
- attach_function :proj_cs_get_axis_info, [:PJ_CONTEXT, :PJ, :int, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer], :bool
124
- attach_function :proj_crs_get_coordoperation, [:PJ_CONTEXT, :PJ], :PJ
125
- attach_function :proj_coordoperation_get_accuracy, [:PJ_CONTEXT, :PJ], :double
126
- attach_function :proj_coordoperation_get_method_info, [:PJ_CONTEXT, :PJ, :pointer, :pointer, :pointer], :int
127
- attach_function :proj_coordoperation_get_towgs84_values, [:PJ_CONTEXT, :PJ, :pointer, :int, :int], :int
128
- attach_function :proj_concatoperation_get_step_count, [:PJ_CONTEXT, :PJ], :int
129
- attach_function :proj_concatoperation_get_step, [:PJ_CONTEXT, :PJ, :int], :PJ
130
-
131
- attach_function :proj_get_ellipsoid, [:PJ_CONTEXT, :PJ], :PJ
132
- attach_function :proj_ellipsoid_get_parameters, [:PJ_CONTEXT, :PJ, :pointer, :pointer, :pointer, :pointer], :int
133
-
134
- attach_function :proj_get_prime_meridian, [:PJ_CONTEXT, :PJ], :PJ
135
- attach_function :proj_prime_meridian_get_parameters, [:PJ_CONTEXT, :PJ, :pointer, :pointer, :pointer], :int
136
-
137
- # ISO-19111
138
- attach_function :proj_create_from_wkt, [:PJ_CONTEXT, :string, :pointer, :PROJ_STRING_LIST, :PROJ_STRING_LIST], :PJ
139
- attach_function :proj_create_from_database, [:PJ_CONTEXT, :string, :string, PJ_CATEGORY, :int, :pointer], :PJ
140
- attach_function :proj_context_guess_wkt_dialect, [:PJ_CONTEXT, :string], PJ_GUESSED_WKT_DIALECT
141
-
142
- # Undocumented apis
143
- attach_function :proj_context_use_proj4_init_rules, [:PJ_CONTEXT, :int], :void
144
- attach_function :proj_context_get_use_proj4_init_rules, [:PJ_CONTEXT, :int], :int
145
- end
146
- end
data/lib/api/api_6_1.rb DELETED
@@ -1,5 +0,0 @@
1
- module Proj
2
- module Api
3
- attach_function :proj_normalize_for_visualization, [:PJ_CONTEXT, :PJ], :PJ
4
- end
5
- end
data/lib/api/api_6_2.rb DELETED
@@ -1,10 +0,0 @@
1
- module Proj
2
- module Api
3
- attach_function :proj_cleanup, [], :void
4
- attach_function :proj_as_projjson, [:PJ_CONTEXT, :PJ, :pointer], :string
5
- attach_function :proj_create_crs_to_crs_from_pj, [:PJ_CONTEXT, :PJ, :PJ, :PJ_AREA, :pointer], :PJ
6
- attach_function :proj_grid_get_info_from_database, [:PJ_CONTEXT, :string, :pointer, :pointer, :pointer, :pointer, :pointer, :pointer], :int
7
- attach_function :proj_context_set_autoclose_database, [:PJ_CONTEXT, :int], :void
8
- attach_function :proj_operation_factory_context_set_discard_superseded, [:PJ_CONTEXT, :pointer, :int], :void
9
- end
10
- end
data/lib/api/api_6_3.rb DELETED
@@ -1,6 +0,0 @@
1
- module Proj
2
- module Api
3
- attach_function :proj_is_equivalent_to_with_ctx, [:PJ_CONTEXT, :PJ, :PJ, PJ_COMPARISON_CRITERION], :int
4
- attach_function :proj_coordoperation_create_inverse, [:PJ_CONTEXT, :PJ], :PJ
5
- end
6
- end