proj4rb 4.1.1 → 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 (116) 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 -38
  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 -680
  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 -672
  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 +54 -25
  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 -5
  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 -1082
  71. data/test/database_test.rb +407 -391
  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 -205
  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 -187
  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 +44 -32
  95. data/ChangeLog +0 -94
  96. data/README.rdoc +0 -189
  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_9_4.rb +0 -6
  114. data/lib/api/api_experimental.rb +0 -201
  115. data/lib/proj/file_api.rb +0 -166
  116. data/lib/proj/network_api.rb +0 -92
@@ -1,281 +1,304 @@
1
- # encoding: UTF-8
2
-
3
- module Proj
4
- # A four dimensional coordinate of double values.
5
- #
6
- # For most geographic CRSes, the units will be in degrees.
7
- class Coordinate
8
- def self.from_coord(pj_coord)
9
- result = self.allocate
10
- result.instance_variable_set(:@coord, pj_coord)
11
- result
12
- end
13
-
14
- # Creates a new coordinate.
15
- #
16
- # @example
17
- #
18
- # coord = Proj::Coordinate.new(:x => 1, :y => 2, :z => 3, :t => 4)
19
- # coord = Proj::Coordinate.new(:u => 5, :v => 6, :w => 7, :t => 8)
20
- # coord = Proj::Coordinate.new(:lam => 9, :phi => 10, :z => 11, :t => 12)
21
- # coord = Proj::Coordinate.new(:lon => 9, :lat => 10, :z => 11, :t => 12)
22
- # coord = Proj::Coordinate.new(:s => 13, :a1 => 14, :a2 => 15)
23
- # coord = Proj::Coordinate.new(:o => 16, :p => 17, :k => 18)
24
- # coord = Proj::Coordinate.new(:e => 19, :n => 20, :u => 21)
25
-
26
- def initialize(x: nil, y: nil, z: nil, t: nil,
27
- u: nil, v: nil, w: nil, # t: nil
28
- lam: nil, phi: nil, # z: nil, t: nil,
29
- lat: nil, lon: nil, # z: nil, t: nil,
30
- s: nil, a1: nil, a2: nil,
31
- o: nil, p: nil, k: nil,
32
- e: nil, n: nil) #u: nil
33
-
34
- @coord = Api::PJ_COORD.new
35
-
36
- keys = if x && y && z && t
37
- [:x, :y, :z, :t]
38
- elsif x && y && z
39
- [:x, :y, :z]
40
- elsif x && y
41
- [:x, :y]
42
- elsif u && v && w && t
43
- [:u, :v, :w, :t]
44
- elsif u && v && w
45
- [:u, :v, :w]
46
- elsif u && v
47
- [:u, :v]
48
- elsif lam && phi && z && t
49
- [:lam, :phi, :z, :t]
50
- elsif lam && phi && z
51
- [:lam, :phi, :z]
52
- elsif lam && phi
53
- [:lam, :phi]
54
- elsif lon && lat && z && t
55
- [:lon, :lat, :z, :t]
56
- elsif lon && lat && z
57
- [:lon, :lat, :z]
58
- elsif lon && lat
59
- [:lon, :lat]
60
- elsif s && a1 && a2
61
- [:s, :a1, :a2]
62
- elsif e && n && u
63
- [:e, :n, :u]
64
- elsif o && p && k
65
- [:o, :p, :k]
66
- else
67
- []
68
- end
69
-
70
- coord_struct = @coord[:v]
71
- keys.each_with_index do |key, index|
72
- coord_struct[index] = binding.local_variable_get(key)
73
- end
74
- end
75
-
76
- def to_ptr
77
- @coord.to_ptr
78
- end
79
-
80
- def pj_coord
81
- @coord
82
- end
83
-
84
- def eql?(other)
85
- @coord == other.instance_variable_get(:@coord)
86
- end
87
-
88
- def ==(other)
89
- @coord.eql?(other.instance_variable_get(:@coord))
90
- end
91
-
92
- def enu
93
- @coord[:enu]
94
- end
95
-
96
- def geod
97
- @coord[:geod]
98
- end
99
-
100
- def lp
101
- @coord[:lp]
102
- end
103
-
104
- def lpz
105
- @coord[:lpz]
106
- end
107
-
108
- def lpzt
109
- @coord[:lpzt]
110
- end
111
-
112
- def opk
113
- @coord[:opk]
114
- end
115
-
116
- def uv
117
- @coord[:uv]
118
- end
119
-
120
- def uvw
121
- @coord[:uvw]
122
- end
123
-
124
- def uvwt
125
- @coord[:uvwt]
126
- end
127
-
128
- def xy
129
- @coord[:xy]
130
- end
131
-
132
- def xyz
133
- @coord[:xyz]
134
- end
135
-
136
- def xyzt
137
- @coord[:xyzt]
138
- end
139
-
140
- # Returns x coordinate
141
- #
142
- # @return [Float]
143
- def x
144
- @coord[:v][0]
145
- end
146
-
147
- # Returns y coordinate
148
- #
149
- # @return [Float]
150
- def y
151
- @coord[:v][1]
152
- end
153
-
154
- # Returns z coordinate
155
- #
156
- # @return [Float]
157
- def z
158
- @coord[:v][2]
159
- end
160
-
161
- # Returns t coordinate
162
- #
163
- # @return [Float]
164
- def t
165
- @coord[:v][3]
166
- end
167
-
168
- # Returns u coordinate
169
- #
170
- # @return [Float]
171
- # TODO - This could be u in uvw or enu. Going to ignore that
172
- def u
173
- @coord[:v][0]
174
- end
175
-
176
- # Returns v coordinate
177
- #
178
- # @return [Float]
179
- def v
180
- @coord[:v][1]
181
- end
182
-
183
- # Returns w coordinate
184
- #
185
- # @return [Float]
186
- def w
187
- @coord[:v][2]
188
- end
189
-
190
- # Returns longitude coordinate
191
- #
192
- # @return [Float]
193
- def lon
194
- @coord[:v][0]
195
- end
196
-
197
- # Returns latitude coordinate
198
- #
199
- # @return [Float]
200
- def lat
201
- @coord[:v][1]
202
- end
203
-
204
- # Returns lam coordinate
205
- #
206
- # @return [Float]
207
- def lam
208
- @coord[:v][0]
209
- end
210
-
211
- # Returns phi coordinate
212
- #
213
- # @return [Float]
214
- def phi
215
- @coord[:v][1]
216
- end
217
-
218
- # Returns o coordinate
219
- #
220
- # @return [Float]
221
- def o
222
- @coord[:v][0]
223
- end
224
-
225
- # Returns p coordinate
226
- #
227
- # @return [Float]
228
- def p
229
- @coord[:v][1]
230
- end
231
-
232
- # Returns k coordinate
233
- #
234
- # @return [Float]
235
- def k
236
- @coord[:v][3]
237
- end
238
-
239
- # Returns e coordinate
240
- #
241
- # @return [Float]
242
- def e
243
- @coord[:v][0]
244
- end
245
-
246
- # Returns n coordinate
247
- #
248
- # @return [Float]
249
- def n
250
- @coord[:v][1]
251
- end
252
-
253
- # Returns s coordinate
254
- #
255
- # @return [Float]
256
- def s
257
- @coord[:v][0]
258
- end
259
-
260
- # Returns a1 coordinate
261
- #
262
- # @return [Float]
263
- def a1
264
- @coord[:v][1]
265
- end
266
-
267
- # Returns a2 coordinate
268
- #
269
- # @return [Float]
270
- def a2
271
- @coord[:v][2]
272
- end
273
-
274
- # Returns nice printout of coordinate contents
275
- #
276
- # @return [String]
277
- def to_s
278
- "v0: #{self.x}, v1: #{self.y}, v2: #{self.z}, v3: #{self.t}"
279
- end
280
- end
281
- end
1
+ # encoding: UTF-8
2
+
3
+ module Proj
4
+ # A four dimensional coordinate of double values.
5
+ #
6
+ # For most geographic CRSes, the units will be in degrees.
7
+ class Coordinate
8
+ def self.from_coord(pj_coord)
9
+ result = self.allocate
10
+ result.instance_variable_set(:@coord, pj_coord)
11
+ result
12
+ end
13
+
14
+ # Calculate the 2-dimensional euclidean distance between two projected coordinates.
15
+ #
16
+ # @see https://proj.org/development/reference/functions.html#c.proj_xy_dist
17
+ #
18
+ # @param coord1 [Coordinate] Coordinate of first point
19
+ # @param coord2 [Coordinate] Coordinate of second point
20
+ #
21
+ # @return [Float] Distance between the coordinates
22
+ def self.xy_distance(coord1, coord2)
23
+ Api.proj_xy_dist(coord1, coord2)
24
+ end
25
+
26
+ # Calculate the 3-dimensional euclidean distance between two projected coordinates.
27
+ #
28
+ # @see https://proj.org/development/reference/functions.html#c.proj_xyz_dist
29
+ #
30
+ # @param coord1 [Coordinate] Coordinate of first point
31
+ # @param coord2 [Coordinate] Coordinate of second point
32
+ #
33
+ # @return [Float] Distance between the coordinates
34
+ def self.xyz_distance(coord1, coord2)
35
+ Api.proj_xyz_dist(coord1, coord2)
36
+ end
37
+
38
+ # Creates a new coordinate.
39
+ #
40
+ # @example
41
+ #
42
+ # coord = Proj::Coordinate.new(:x => 1, :y => 2, :z => 3, :t => 4)
43
+ # coord = Proj::Coordinate.new(:u => 5, :v => 6, :w => 7, :t => 8)
44
+ # coord = Proj::Coordinate.new(:lam => 9, :phi => 10, :z => 11, :t => 12)
45
+ # coord = Proj::Coordinate.new(:lon => 9, :lat => 10, :z => 11, :t => 12)
46
+ # coord = Proj::Coordinate.new(:s => 13, :a1 => 14, :a2 => 15)
47
+ # coord = Proj::Coordinate.new(:o => 16, :p => 17, :k => 18)
48
+ # coord = Proj::Coordinate.new(:e => 19, :n => 20, :u => 21)
49
+
50
+ def initialize(x: nil, y: nil, z: nil, t: nil,
51
+ u: nil, v: nil, w: nil, # t: nil
52
+ lam: nil, phi: nil, # z: nil, t: nil,
53
+ lat: nil, lon: nil, # z: nil, t: nil,
54
+ s: nil, a1: nil, a2: nil,
55
+ o: nil, p: nil, k: nil,
56
+ e: nil, n: nil) #u: nil
57
+
58
+ @coord = Api::PjCoord.new
59
+
60
+ keys = if x && y && z && t
61
+ [:x, :y, :z, :t]
62
+ elsif x && y && z
63
+ [:x, :y, :z]
64
+ elsif x && y
65
+ [:x, :y]
66
+ elsif u && v && w && t
67
+ [:u, :v, :w, :t]
68
+ elsif u && v && w
69
+ [:u, :v, :w]
70
+ elsif u && v
71
+ [:u, :v]
72
+ elsif lam && phi && z && t
73
+ [:lam, :phi, :z, :t]
74
+ elsif lam && phi && z
75
+ [:lam, :phi, :z]
76
+ elsif lam && phi
77
+ [:lam, :phi]
78
+ elsif lon && lat && z && t
79
+ [:lon, :lat, :z, :t]
80
+ elsif lon && lat && z
81
+ [:lon, :lat, :z]
82
+ elsif lon && lat
83
+ [:lon, :lat]
84
+ elsif s && a1 && a2
85
+ [:s, :a1, :a2]
86
+ elsif e && n && u
87
+ [:e, :n, :u]
88
+ elsif o && p && k
89
+ [:o, :p, :k]
90
+ else
91
+ []
92
+ end
93
+
94
+ coord_struct = @coord[:v]
95
+ keys.each_with_index do |key, index|
96
+ coord_struct[index] = binding.local_variable_get(key)
97
+ end
98
+ end
99
+
100
+ def to_ptr
101
+ @coord.to_ptr
102
+ end
103
+
104
+ def pj_coord
105
+ @coord
106
+ end
107
+
108
+ def eql?(other)
109
+ other.is_a?(Coordinate) &&
110
+ self.x == other.x && self.y == other.y && self.z == other.z && self.t == other.t
111
+ end
112
+
113
+ alias == eql?
114
+
115
+ def enu
116
+ @coord[:enu]
117
+ end
118
+
119
+ def geod
120
+ @coord[:geod]
121
+ end
122
+
123
+ def lp
124
+ @coord[:lp]
125
+ end
126
+
127
+ def lpz
128
+ @coord[:lpz]
129
+ end
130
+
131
+ def lpzt
132
+ @coord[:lpzt]
133
+ end
134
+
135
+ def opk
136
+ @coord[:opk]
137
+ end
138
+
139
+ def uv
140
+ @coord[:uv]
141
+ end
142
+
143
+ def uvw
144
+ @coord[:uvw]
145
+ end
146
+
147
+ def uvwt
148
+ @coord[:uvwt]
149
+ end
150
+
151
+ def xy
152
+ @coord[:xy]
153
+ end
154
+
155
+ def xyz
156
+ @coord[:xyz]
157
+ end
158
+
159
+ def xyzt
160
+ @coord[:xyzt]
161
+ end
162
+
163
+ # Returns x coordinate
164
+ #
165
+ # @return [Float]
166
+ def x
167
+ @coord[:v][0]
168
+ end
169
+
170
+ # Returns y coordinate
171
+ #
172
+ # @return [Float]
173
+ def y
174
+ @coord[:v][1]
175
+ end
176
+
177
+ # Returns z coordinate
178
+ #
179
+ # @return [Float]
180
+ def z
181
+ @coord[:v][2]
182
+ end
183
+
184
+ # Returns t coordinate
185
+ #
186
+ # @return [Float]
187
+ def t
188
+ @coord[:v][3]
189
+ end
190
+
191
+ # Returns u coordinate
192
+ #
193
+ # @return [Float]
194
+ # TODO - This could be u in uvw or enu. Going to ignore that
195
+ def u
196
+ @coord[:v][0]
197
+ end
198
+
199
+ # Returns v coordinate
200
+ #
201
+ # @return [Float]
202
+ def v
203
+ @coord[:v][1]
204
+ end
205
+
206
+ # Returns w coordinate
207
+ #
208
+ # @return [Float]
209
+ def w
210
+ @coord[:v][2]
211
+ end
212
+
213
+ # Returns longitude coordinate
214
+ #
215
+ # @return [Float]
216
+ def lon
217
+ @coord[:v][0]
218
+ end
219
+
220
+ # Returns latitude coordinate
221
+ #
222
+ # @return [Float]
223
+ def lat
224
+ @coord[:v][1]
225
+ end
226
+
227
+ # Returns lam coordinate
228
+ #
229
+ # @return [Float]
230
+ def lam
231
+ @coord[:v][0]
232
+ end
233
+
234
+ # Returns phi coordinate
235
+ #
236
+ # @return [Float]
237
+ def phi
238
+ @coord[:v][1]
239
+ end
240
+
241
+ # Returns o coordinate
242
+ #
243
+ # @return [Float]
244
+ def o
245
+ @coord[:v][0]
246
+ end
247
+
248
+ # Returns p coordinate
249
+ #
250
+ # @return [Float]
251
+ def p
252
+ @coord[:v][1]
253
+ end
254
+
255
+ # Returns k coordinate
256
+ #
257
+ # @return [Float]
258
+ def k
259
+ @coord[:v][2]
260
+ end
261
+
262
+ # Returns e coordinate
263
+ #
264
+ # @return [Float]
265
+ def e
266
+ @coord[:v][0]
267
+ end
268
+
269
+ # Returns n coordinate
270
+ #
271
+ # @return [Float]
272
+ def n
273
+ @coord[:v][1]
274
+ end
275
+
276
+ # Returns s coordinate
277
+ #
278
+ # @return [Float]
279
+ def s
280
+ @coord[:v][0]
281
+ end
282
+
283
+ # Returns a1 coordinate
284
+ #
285
+ # @return [Float]
286
+ def a1
287
+ @coord[:v][1]
288
+ end
289
+
290
+ # Returns a2 coordinate
291
+ #
292
+ # @return [Float]
293
+ def a2
294
+ @coord[:v][2]
295
+ end
296
+
297
+ # Returns nice printout of coordinate contents
298
+ #
299
+ # @return [String]
300
+ def to_s
301
+ "v0: #{self.x}, v1: #{self.y}, v2: #{self.z}, v3: #{self.t}"
302
+ end
303
+ end
304
+ end
@@ -1,38 +1,38 @@
1
- # encoding: UTF-8
2
-
3
- module Proj
4
- # Coordinate metadata is the information required to make coordinates unambiguous. For a
5
- # coordinate set referenced to a static CRS it is the CRS definition. For a
6
- # coordinate set referenced to a dynamic CRS it is the CRS definition together
7
- # with the coordinate epoch of the coordinates in the coordinate set.
8
- #
9
- # In a dynamic CRS, coordinates of a point on the surface of the Earth may change with time.
10
- # To be unambiguous the coordinates must always be qualified with the epoch at which they
11
- # are valid. The coordinate epoch is not necessarily the epoch at which the observation
12
- # was collected.
13
- class CoordinateMetadata < PjObject
14
- # Create a CoordinateMetadata object
15
- #
16
- # @param crs [Crs] The associated Crs
17
- # @param context [Context]. An optional Context
18
- # @param epoch [Double]. Epoch at wich the CRS is valid
19
- #
20
- # @return [CoordinateMetadata]
21
- def initialize(crs, context=nil, epoch=nil)
22
- ptr = Api.proj_coordinate_metadata_create(context || Context.current, crs, epoch)
23
-
24
- if ptr.null?
25
- Error.check_object(self)
26
- end
27
-
28
- super(ptr, context)
29
- end
30
-
31
- # Returns the coordinate epoch
32
- #
33
- # @return [Double]
34
- def epoch
35
- Api.proj_coordinate_metadata_get_epoch(self.context, self)
36
- end
37
- end
38
- end
1
+ # encoding: UTF-8
2
+
3
+ module Proj
4
+ # Coordinate metadata is the information required to make coordinates unambiguous. For a
5
+ # coordinate set referenced to a static CRS it is the CRS definition. For a
6
+ # coordinate set referenced to a dynamic CRS it is the CRS definition together
7
+ # with the coordinate epoch of the coordinates in the coordinate set.
8
+ #
9
+ # In a dynamic CRS, coordinates of a point on the surface of the Earth may change with time.
10
+ # To be unambiguous the coordinates must always be qualified with the epoch at which they
11
+ # are valid. The coordinate epoch is not necessarily the epoch at which the observation
12
+ # was collected.
13
+ class CoordinateMetadata < PjObject
14
+ # Create a CoordinateMetadata object
15
+ #
16
+ # @param crs [Crs] The associated Crs
17
+ # @param context [Context]. An optional Context
18
+ # @param epoch [Double]. Epoch at wich the CRS is valid
19
+ #
20
+ # @return [CoordinateMetadata]
21
+ def initialize(crs, context=nil, epoch=0)
22
+ ptr = Api.proj_coordinate_metadata_create(context || Context.current, crs, epoch)
23
+
24
+ if ptr.null?
25
+ Error.check_object(self)
26
+ end
27
+
28
+ super(ptr, context)
29
+ end
30
+
31
+ # Returns the coordinate epoch
32
+ #
33
+ # @return [Double]
34
+ def epoch
35
+ Api.proj_coordinate_metadata_get_epoch(self.context, self)
36
+ end
37
+ end
38
+ end