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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +98 -0
- data/Gemfile +4 -4
- data/README.md +53 -0
- data/lib/api/proj.rb +750 -0
- data/lib/api/proj_experimental.rb +7 -0
- data/lib/api/proj_ffi.rb +47 -0
- data/lib/api/proj_version.rb +26 -0
- data/lib/examples/axis_order_normalization.rb +13 -0
- data/lib/examples/batch_transformation.rb +25 -0
- data/lib/examples/context_logging.rb +26 -0
- data/lib/examples/crs_identification.rb +18 -0
- data/lib/examples/database_query.rb +27 -0
- data/lib/examples/geodetic_distance.rb +38 -0
- data/lib/examples/geodetic_to_projected.rb +18 -0
- data/lib/examples/operation_factory_context.rb +19 -0
- data/lib/examples/pipeline_operator.rb +21 -0
- data/lib/examples/promote_demote_3d.rb +23 -0
- data/lib/examples/serialization_formats.rb +17 -0
- data/lib/examples/transform_bounds.rb +18 -0
- data/lib/examples/transformation_with_area.rb +18 -0
- data/lib/proj/area.rb +74 -74
- data/lib/proj/axis_info.rb +44 -44
- data/lib/proj/bounds.rb +22 -0
- data/lib/proj/bounds3d.rb +45 -0
- data/lib/proj/context.rb +57 -23
- data/lib/proj/conversion.rb +94 -91
- data/lib/proj/coordinate.rb +304 -281
- data/lib/proj/coordinate_metadata.rb +38 -38
- data/lib/proj/coordinate_operation_mixin.rb +464 -381
- data/lib/proj/coordinate_system.rb +143 -137
- data/lib/proj/crs.rb +688 -680
- data/lib/proj/crs_info.rb +47 -47
- data/lib/proj/database.rb +310 -305
- data/lib/proj/datum.rb +32 -32
- data/lib/proj/datum_ensemble.rb +34 -34
- data/lib/proj/domain.rb +82 -0
- data/lib/proj/ellipsoid.rb +77 -77
- data/lib/proj/error.rb +7 -8
- data/lib/proj/file_api_callbacks.rb +165 -0
- data/lib/proj/grid.rb +121 -121
- data/lib/proj/grid_cache.rb +65 -64
- data/lib/proj/grid_info.rb +19 -19
- data/lib/proj/life_span.rb +21 -0
- data/lib/proj/network_api_callbacks.rb +86 -0
- data/lib/proj/operation.rb +66 -42
- data/lib/proj/operation_factory_context.rb +4 -2
- data/lib/proj/options.rb +41 -0
- data/lib/proj/parameter.rb +37 -37
- data/lib/proj/parameters.rb +106 -107
- data/lib/proj/pj_axis_description.rb +26 -0
- data/lib/proj/pj_object.rb +602 -672
- data/lib/proj/pj_objects.rb +45 -45
- data/lib/proj/pj_param_description.rb +28 -0
- data/lib/proj/prime_meridian.rb +65 -65
- data/lib/proj/projection.rb +54 -25
- data/lib/proj/session.rb +2 -0
- data/lib/proj/transformation.rb +102 -102
- data/lib/proj/unit.rb +81 -108
- data/lib/proj.rb +10 -3
- data/lib/proj4.rb +5 -5
- data/proj4rb.gemspec +10 -5
- data/test/abstract_test.rb +7 -5
- data/test/context_test.rb +210 -172
- data/test/context_validation_test.rb +11 -0
- data/test/conversion_test.rb +376 -368
- data/test/coordinate_metadata_test.rb +34 -0
- data/test/coordinate_system_test.rb +162 -144
- data/test/coordinate_test.rb +289 -34
- data/test/crs_test.rb +1112 -1082
- data/test/database_test.rb +407 -391
- data/test/datum_ensemble_test.rb +64 -64
- data/test/datum_test.rb +61 -54
- data/test/domain_test.rb +72 -0
- data/test/ellipsoid_test.rb +80 -80
- data/test/examples_test.rb +149 -0
- data/test/file_api_example.rb +58 -0
- data/test/file_api_test.rb +74 -66
- data/test/grid_cache_test.rb +72 -72
- data/test/grid_test.rb +126 -141
- data/test/network_api_example.rb +48 -0
- data/test/network_api_test.rb +33 -45
- data/test/operation_factory_context_test.rb +225 -205
- data/test/operation_test.rb +40 -29
- data/test/options_test.rb +17 -0
- data/test/parameters_test.rb +86 -40
- data/test/pj_object_test.rb +221 -187
- data/test/prime_meridian_test.rb +75 -75
- data/test/proj_test.rb +58 -58
- data/test/projection_test.rb +680 -650
- data/test/session_test.rb +78 -77
- data/test/transformation_test.rb +238 -210
- data/test/unit_test.rb +114 -76
- metadata +44 -32
- data/ChangeLog +0 -94
- data/README.rdoc +0 -189
- data/lib/api/api.rb +0 -117
- data/lib/api/api_5_0.rb +0 -338
- data/lib/api/api_5_1.rb +0 -7
- data/lib/api/api_5_2.rb +0 -5
- data/lib/api/api_6_0.rb +0 -146
- data/lib/api/api_6_1.rb +0 -5
- data/lib/api/api_6_2.rb +0 -10
- data/lib/api/api_6_3.rb +0 -6
- data/lib/api/api_7_0.rb +0 -69
- data/lib/api/api_7_1.rb +0 -73
- data/lib/api/api_7_2.rb +0 -14
- data/lib/api/api_8_0.rb +0 -6
- data/lib/api/api_8_1.rb +0 -24
- data/lib/api/api_8_2.rb +0 -6
- data/lib/api/api_9_1.rb +0 -7
- data/lib/api/api_9_2.rb +0 -9
- data/lib/api/api_9_4.rb +0 -6
- data/lib/api/api_experimental.rb +0 -201
- data/lib/proj/file_api.rb +0 -166
- data/lib/proj/network_api.rb +0 -92
data/lib/proj/coordinate.rb
CHANGED
|
@@ -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
|
-
#
|
|
15
|
-
#
|
|
16
|
-
# @
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
[:
|
|
62
|
-
elsif
|
|
63
|
-
[:
|
|
64
|
-
elsif
|
|
65
|
-
[:
|
|
66
|
-
|
|
67
|
-
[]
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
end
|
|
99
|
-
|
|
100
|
-
def
|
|
101
|
-
@coord
|
|
102
|
-
end
|
|
103
|
-
|
|
104
|
-
def
|
|
105
|
-
@coord
|
|
106
|
-
end
|
|
107
|
-
|
|
108
|
-
def
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
def
|
|
144
|
-
@coord[:
|
|
145
|
-
end
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
#
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
#
|
|
171
|
-
#
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
#
|
|
178
|
-
#
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
#
|
|
185
|
-
#
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
#
|
|
192
|
-
#
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
#
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
#
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
#
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
#
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
#
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
#
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
#
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
#
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
#
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
#
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
#
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
#
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
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=
|
|
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
|