proj4rb 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/ChangeLog +46 -0
- data/Gemfile +4 -0
- data/README.rdoc +158 -148
- data/Rakefile +26 -41
- data/lib/area.rb +32 -0
- data/lib/config.rb +70 -0
- data/lib/context.rb +103 -0
- data/lib/coordinate.rb +197 -0
- data/lib/crs.rb +206 -0
- data/lib/ellipsoid.rb +42 -0
- data/lib/error.rb +18 -0
- data/lib/operation.rb +43 -0
- data/lib/pj_object.rb +82 -0
- data/lib/point.rb +72 -0
- data/lib/prime_meridian.rb +40 -0
- data/lib/proj.rb +31 -0
- data/lib/proj4.rb +3 -469
- data/lib/projection.rb +207 -0
- data/lib/transformation.rb +61 -0
- data/lib/unit.rb +54 -0
- data/proj4rb.gemspec +31 -0
- data/test/abstract_test.rb +7 -0
- data/test/context_test.rb +82 -0
- data/test/coordinate_test.rb +35 -0
- data/test/crs_test.rb +373 -0
- data/test/ellipsoid_test.rb +34 -0
- data/test/operation_test.rb +29 -0
- data/test/prime_meridians_test.rb +33 -0
- data/test/proj_test.rb +17 -0
- data/test/projection_test.rb +224 -0
- data/test/transformation_test.rb +68 -0
- data/test/unit_test.rb +47 -0
- metadata +82 -77
- data/data/GL27 +0 -22
- data/data/MD +0 -0
- data/data/TN +0 -0
- data/data/WI +0 -0
- data/data/WO +0 -0
- data/data/conus +0 -0
- data/data/epsg +0 -5443
- data/data/epsg-deprecated +0 -2
- data/data/esri +0 -5937
- data/data/esri.extra +0 -948
- data/data/hawaii +0 -0
- data/data/nad.lst +0 -142
- data/data/nad27 +0 -809
- data/data/nad83 +0 -744
- data/data/ntv1_can.dat +0 -0
- data/data/null +0 -0
- data/data/other.extra +0 -49
- data/data/proj_def.dat +0 -17
- data/data/prvi +0 -0
- data/data/stgeorge +0 -0
- data/data/stlrnc +0 -0
- data/data/stpaul +0 -0
- data/data/world +0 -212
- data/example/basic.rb +0 -18
- data/example/list-datums.rb +0 -17
- data/example/list-ellipsoids.rb +0 -17
- data/example/list-errors.rb +0 -11
- data/example/list-prime-meridians.rb +0 -17
- data/example/list-projection-types.rb +0 -17
- data/example/list-units.rb +0 -17
- data/example/version.rb +0 -8
- data/ext/Makefile +0 -238
- data/ext/extconf.rb +0 -16
- data/ext/mkmf.log +0 -103
- data/ext/out.log +0 -0
- data/ext/proj4_ruby-x64-mingw32.def +0 -2
- data/ext/proj4_ruby.so +0 -0
- data/ext/projrb.c +0 -566
- data/ext/projrb.o +0 -0
- data/ext/vc/proj4_ruby.sln +0 -19
- data/ext/vc/proj4_ruby.vcproj +0 -208
- data/test/test_constants.rb +0 -18
- data/test/test_create_projection.rb +0 -63
- data/test/test_datums.rb +0 -45
- data/test/test_ellipsoids.rb +0 -46
- data/test/test_errors.rb +0 -66
- data/test/test_init_projection.rb +0 -109
- data/test/test_prime_meridians.rb +0 -45
- data/test/test_projection_type.rb +0 -44
- data/test/test_simple_projection.rb +0 -58
- data/test/test_suite.rb +0 -14
- data/test/test_transform.rb +0 -115
- data/test/test_units.rb +0 -46
@@ -0,0 +1,33 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require_relative './abstract_test'
|
4
|
+
|
5
|
+
class PrimeMeridiansTest < AbstractTest
|
6
|
+
def test_get_all
|
7
|
+
prime_meridians = Proj::PrimeMeridian.list.sort.collect {|prime_meridian| prime_meridian.id}
|
8
|
+
assert prime_meridians.index('greenwich')
|
9
|
+
assert prime_meridians.index('athens')
|
10
|
+
assert prime_meridians.index('lisbon')
|
11
|
+
assert prime_meridians.index('rome')
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_one
|
15
|
+
prime_meridian = Proj::PrimeMeridian.get('lisbon')
|
16
|
+
assert_kind_of(Proj::PrimeMeridian, prime_meridian)
|
17
|
+
assert_equal('lisbon', prime_meridian.id)
|
18
|
+
assert_equal('9d07\'54.862"W', prime_meridian.defn)
|
19
|
+
assert_equal('#<Proj::PrimeMeridian id="lisbon", defn="9d07\'54.862"W">', prime_meridian.inspect)
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_compare
|
23
|
+
u1 = Proj::PrimeMeridian.get('lisbon')
|
24
|
+
u2 = Proj::PrimeMeridian.get('lisbon')
|
25
|
+
assert u1 == u2
|
26
|
+
end
|
27
|
+
|
28
|
+
def test_failed_get
|
29
|
+
prime_meridian = Proj::PrimeMeridian.get('foo')
|
30
|
+
assert_nil prime_meridian
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
data/test/proj_test.rb
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require_relative './abstract_test'
|
4
|
+
|
5
|
+
class ProjTest < AbstractTest
|
6
|
+
def test_info
|
7
|
+
info = Proj.info
|
8
|
+
assert_equal(6, info[:major])
|
9
|
+
assert_equal(2, info[:minor])
|
10
|
+
assert_equal(1, info[:patch])
|
11
|
+
assert_equal('Rel. 6.2.1, November 1st, 2019', info[:release])
|
12
|
+
assert_equal('6.2.1', info[:version])
|
13
|
+
refute_nil(info[:searchpath])
|
14
|
+
refute(info[:paths].null?)
|
15
|
+
assert_equal(1, info[:path_count])
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,224 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require_relative './abstract_test'
|
4
|
+
|
5
|
+
class ProjectionTest < AbstractTest
|
6
|
+
PRECISION = 0.1 ** 4
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@proj_wgs84 = Proj::Projection.new(["init=epsg:4326"]) # WGS84
|
10
|
+
@proj_gk = Proj::Projection.new(["+init=epsg:31467"]) # Gauss-Kruger Zone 3
|
11
|
+
@proj_merc = Proj::Projection.new(["proj=merc"])
|
12
|
+
@proj_conakry = Proj::Projection.new(["+init=epsg:31528"]) # Conakry 1905 / UTM zone 28N
|
13
|
+
@proj_ortel = Proj::Projection.new(["+proj=ortel", "+lon_0=90w"]) # Ortelius Oval Projection
|
14
|
+
@epsg2029i = ['+init=epsg:2029']
|
15
|
+
@epsg2029_args = ['+proj=utm', '+zone=17', '+ellps=clrk66', '+units=m', '+no_defs']
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_arg_fail
|
19
|
+
assert_raises ArgumentError do
|
20
|
+
Proj::Projection.parse()
|
21
|
+
end
|
22
|
+
assert_raises ArgumentError do
|
23
|
+
Proj::Projection.parse(nil)
|
24
|
+
end
|
25
|
+
assert_raises ArgumentError do
|
26
|
+
Proj::Projection.parse(1)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_arg_string
|
31
|
+
args = Proj::Projection.parse('+init=epsg:2029')
|
32
|
+
assert_equal(@epsg2029i, args)
|
33
|
+
args = Proj::Projection.parse(' +proj=utm +zone=17 +ellps=clrk66 +units=m +no_defs ')
|
34
|
+
assert_equal(@epsg2029_args, args)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_arg_string_with_plus
|
38
|
+
args = Proj::Projection.parse('+init=epsg:2029')
|
39
|
+
assert_equal(@epsg2029i, args)
|
40
|
+
args = Proj::Projection.parse('+proj=utm +zone=17 +ellps=clrk66 +units=m +no_defs')
|
41
|
+
assert_equal(@epsg2029_args, args)
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_arg_array
|
45
|
+
args = Proj::Projection.parse(['+init=epsg:2029'])
|
46
|
+
assert_equal(@epsg2029i, args)
|
47
|
+
args = Proj::Projection.parse(['+proj=utm', '+zone=17', '+ellps=clrk66', '+units=m', '+no_defs'])
|
48
|
+
assert_equal(@epsg2029_args, args)
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_arg_array_with_plus
|
52
|
+
args = Proj::Projection.parse(['+init=epsg:2029'])
|
53
|
+
assert_equal(@epsg2029i, args)
|
54
|
+
args = Proj::Projection.parse(['+proj=utm', '+zone=17', '+ellps=clrk66', '+units=m', '+no_defs'])
|
55
|
+
assert_equal(@epsg2029_args, args)
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_arg_hash_with_string
|
59
|
+
args = Proj::Projection.parse('init' => 'epsg:2029')
|
60
|
+
assert_equal(@epsg2029i, args)
|
61
|
+
args = Proj::Projection.parse('proj' => 'utm', 'zone' => '17', 'ellps' => 'clrk66', 'units' => 'm', 'no_defs' => nil)
|
62
|
+
assert_equal(@epsg2029_args, args)
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_arg_hash_with_symbol
|
66
|
+
args = Proj::Projection.parse(:init => 'epsg:2029')
|
67
|
+
assert_equal(@epsg2029i, args)
|
68
|
+
args = Proj::Projection.parse(:proj => 'utm', :zone => '17', :ellps => 'clrk66', :units => 'm', :no_defs => nil)
|
69
|
+
assert_equal(@epsg2029_args, args)
|
70
|
+
end
|
71
|
+
|
72
|
+
def test_arg_hash_with_symbol_simple
|
73
|
+
args = Proj::Projection.parse(:init => 'epsg:2029')
|
74
|
+
assert_equal(@epsg2029i, args)
|
75
|
+
args = Proj::Projection.parse(:proj => 'utm', :zone => '17', :ellps => 'clrk66', :units => 'm', :no_defs => nil)
|
76
|
+
assert_equal(@epsg2029_args, args)
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_arg_projection
|
80
|
+
proj = Proj::Projection.new(['+init=epsg:2029'])
|
81
|
+
args = Proj::Projection.parse(proj)
|
82
|
+
assert_equal(["+init=epsg:2029", "+proj=utm", "+zone=17", "+ellps=clrk66", "+units=m", "+no_defs"], args)
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_init_arg_string
|
86
|
+
proj = Proj::Projection.new('+init=epsg:2029')
|
87
|
+
assert_equal(' +init=epsg:2029 +proj=utm +zone=17 +ellps=clrk66 +units=m +no_defs', proj.getDef)
|
88
|
+
end
|
89
|
+
|
90
|
+
def test_init_arg_array
|
91
|
+
proj = Proj::Projection.new(['+init=epsg:2029'])
|
92
|
+
assert_equal(' +init=epsg:2029 +proj=utm +zone=17 +ellps=clrk66 +units=m +no_defs', proj.getDef)
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_init_arg_hash
|
96
|
+
proj = Proj::Projection.new(:proj => 'utm', 'zone' => '17', 'ellps' => 'clrk66', :units => 'm', :no_defs => nil)
|
97
|
+
assert_equal(' +proj=utm +zone=17 +ellps=clrk66 +units=m +no_defs', proj.getDef)
|
98
|
+
end
|
99
|
+
|
100
|
+
def test_init_arg_fail
|
101
|
+
assert_raises Proj::Error do
|
102
|
+
Proj::Projection.new(:proj => 'xxxx')
|
103
|
+
end
|
104
|
+
|
105
|
+
assert_raises Proj::Error do
|
106
|
+
Proj::Projection.new(:foo => 'xxxx')
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
def test_is_latlong
|
111
|
+
assert(@proj_wgs84.isLatLong?)
|
112
|
+
refute(@proj_gk.isLatLong?)
|
113
|
+
refute(@proj_conakry.isLatLong?)
|
114
|
+
refute(@proj_ortel.isLatLong?)
|
115
|
+
end
|
116
|
+
|
117
|
+
def test_is_geocent
|
118
|
+
assert_equal(@proj_gk.isGeocent?, @proj_gk.isGeocentric?) # two names for same method
|
119
|
+
refute(@proj_wgs84.isGeocent?)
|
120
|
+
refute(@proj_gk.isGeocent?)
|
121
|
+
refute(@proj_conakry.isGeocent?)
|
122
|
+
refute(@proj_ortel.isGeocent?)
|
123
|
+
end
|
124
|
+
|
125
|
+
def test_get_def
|
126
|
+
assert_equal(' +init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0', @proj_wgs84.getDef)
|
127
|
+
assert_equal(' +init=epsg:31467 +proj=tmerc +lat_0=0 +lon_0=9 +k=1 +x_0=3500000 +y_0=0 +ellps=bessel +units=m +no_defs', @proj_gk.getDef)
|
128
|
+
assert_equal('+proj=ortel +lon_0=90w +ellps=GRS80', @proj_ortel.getDef.strip)
|
129
|
+
end
|
130
|
+
|
131
|
+
def test_to_s
|
132
|
+
assert_equal('#<Proj::Projection +init=epsg:4326 +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0>', @proj_wgs84.to_s)
|
133
|
+
end
|
134
|
+
|
135
|
+
def test_projection
|
136
|
+
assert_equal('longlat', @proj_wgs84.projection)
|
137
|
+
assert_equal('tmerc', @proj_gk.projection)
|
138
|
+
assert_equal('utm', @proj_conakry.projection)
|
139
|
+
assert_equal('ortel', @proj_ortel.projection)
|
140
|
+
end
|
141
|
+
|
142
|
+
def test_datum
|
143
|
+
assert_equal('WGS84', @proj_wgs84.datum)
|
144
|
+
assert_nil(@proj_gk.datum)
|
145
|
+
assert_nil(@proj_conakry.datum)
|
146
|
+
end
|
147
|
+
|
148
|
+
# echo "8.4302123334 48.9906726079" | proj +init=epsg:31467 -
|
149
|
+
def test_forward_gk
|
150
|
+
point = Proj::Point.new(8.4302123334, 48.9906726079)
|
151
|
+
result = @proj_gk.forward(point.to_radians)
|
152
|
+
assert_in_delta(3458305.0, result.x, 0.1)
|
153
|
+
assert_in_delta(5428192.0, result.y, 0.1)
|
154
|
+
end
|
155
|
+
|
156
|
+
def test_forward_gk_degrees
|
157
|
+
point = Proj::Point.new(8.4302123334, 48.9906726079)
|
158
|
+
result = @proj_gk.forwardDeg(point)
|
159
|
+
assert_in_delta(3458305.0, result.x, 0.1)
|
160
|
+
assert_in_delta(5428192.0, result.y, 0.1)
|
161
|
+
end
|
162
|
+
|
163
|
+
# echo "3458305 5428192" | invproj -f '%.10f' +init=epsg:31467 -
|
164
|
+
def test_inverse_gk
|
165
|
+
point = Proj::Point.new(3458305.0, 5428192.0)
|
166
|
+
result = @proj_gk.inverse(point).to_degrees
|
167
|
+
assert_in_delta(result.x, 8.4302123334, PRECISION)
|
168
|
+
assert_in_delta(result.y, 48.9906726079, PRECISION)
|
169
|
+
end
|
170
|
+
|
171
|
+
def test_inverse_gk_degrees
|
172
|
+
point = Proj::Point.new(3458305.0, 5428192.0)
|
173
|
+
result = @proj_gk.inverseDeg(point)
|
174
|
+
assert_in_delta(result.x, 8.4302123334, PRECISION)
|
175
|
+
assert_in_delta(result.y, 48.9906726079, PRECISION)
|
176
|
+
end
|
177
|
+
|
178
|
+
# echo "190 92" | proj +init=epsg:31467 -
|
179
|
+
def test_out_of_bounds
|
180
|
+
error = assert_raises(Proj::Error) do
|
181
|
+
point = Proj::Point.new(190, 92).to_radians
|
182
|
+
@proj_gk.forward(point)
|
183
|
+
end
|
184
|
+
assert_equal('latitude or longitude exceeded limits', error.message)
|
185
|
+
end
|
186
|
+
|
187
|
+
# echo "3458305 5428192" | cs2cs -f '%.10f' +init=epsg:31467 +to +init=epsg:4326 -
|
188
|
+
def test_gk_to_wgs84
|
189
|
+
from = Proj::Point.new(3458305.0, 5428192.0)
|
190
|
+
to = @proj_gk.transform(@proj_wgs84, from).to_degrees
|
191
|
+
assert_in_delta(8.4302123334, to.x, PRECISION)
|
192
|
+
assert_in_delta(48.9906726079, to.y, PRECISION)
|
193
|
+
end
|
194
|
+
|
195
|
+
# echo "8.4293092923 48.9896114523" | cs2cs -f '%.10f' +init=epsg:4326 +to +init=epsg:31467 -
|
196
|
+
def test_wgs84_to_gk
|
197
|
+
from = Proj::Point.new(8.4302123334, 48.9906726079)
|
198
|
+
to = @proj_wgs84.transform(@proj_gk, from.to_radians)
|
199
|
+
assert_in_delta(3458305.0, to.x, PRECISION)
|
200
|
+
assert_in_delta(5428192.0, to.y, PRECISION)
|
201
|
+
end
|
202
|
+
|
203
|
+
def test_mercator_at_pole_raise
|
204
|
+
from = Proj::Point.new(0, 90)
|
205
|
+
assert_raises(Proj::Error) do
|
206
|
+
@proj_wgs84.transform(@proj_merc, from.to_radians)
|
207
|
+
end
|
208
|
+
end
|
209
|
+
|
210
|
+
def test_collection
|
211
|
+
from0 = Proj::Point.new(3458305.0, 5428192.0)
|
212
|
+
from1 = Proj::Point.new(0, 0)
|
213
|
+
collection = @proj_gk.transform_all(@proj_wgs84, [from0, from1])
|
214
|
+
|
215
|
+
to0 = collection[0].to_degrees
|
216
|
+
to1 = collection[1].to_degrees
|
217
|
+
|
218
|
+
assert_in_delta(8.4302123334, to0.x, PRECISION)
|
219
|
+
assert_in_delta(48.9906726079, to0.y, PRECISION)
|
220
|
+
|
221
|
+
assert_in_delta(-20.9657785647, to1.x, PRECISION)
|
222
|
+
assert_in_delta(0, to1.y, PRECISION)
|
223
|
+
end
|
224
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require_relative './abstract_test'
|
4
|
+
|
5
|
+
class TransformationTest < AbstractTest
|
6
|
+
PRECISION = 0.5
|
7
|
+
|
8
|
+
def setup
|
9
|
+
@crs_wgs84 = Proj::Crs.new('epsg:4326')
|
10
|
+
@crs_gk = Proj::Crs.new('epsg:31467')
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_create_from_strings
|
14
|
+
transform = Proj::Transformation.new('epsg:31467', 'epsg:4326')
|
15
|
+
assert(transform.info)
|
16
|
+
end
|
17
|
+
|
18
|
+
def test_create_crs
|
19
|
+
transform = Proj::Transformation.new(@crs_wgs84, @crs_gk)
|
20
|
+
assert(transform.info)
|
21
|
+
end
|
22
|
+
|
23
|
+
# echo "3458305 5428192" | cs2cs -f '%.10f' +init=epsg:31467 +to +init=epsg:4326 -
|
24
|
+
def test_gk_to_wgs84_forward
|
25
|
+
transform = Proj::Transformation.new(@crs_gk, @crs_wgs84)
|
26
|
+
from = Proj::Coordinate.new(x: 5428192.0, y: 3458305.0, z: -5.1790915237)
|
27
|
+
to = transform.forward(from)
|
28
|
+
|
29
|
+
assert_in_delta(48.98963932450735, to.x, PRECISION)
|
30
|
+
assert_in_delta(8.429263044355544, to.y, PRECISION)
|
31
|
+
assert_in_delta(-5.1790915237, to.z, PRECISION)
|
32
|
+
assert_in_delta(0, to.t, PRECISION)
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_gk_to_wgs84_inverse
|
36
|
+
transform = Proj::Transformation.new(@crs_gk, @crs_wgs84)
|
37
|
+
from = Proj::Coordinate.new(lam: 48.9906726079, phi: 8.4302123334)
|
38
|
+
to = transform.inverse(from)
|
39
|
+
|
40
|
+
assert_in_delta(5428307, to.x, PRECISION)
|
41
|
+
assert_in_delta(3458375, to.y, PRECISION)
|
42
|
+
assert_in_delta(0, to.z, PRECISION)
|
43
|
+
assert_in_delta(0, to.t, PRECISION)
|
44
|
+
end
|
45
|
+
|
46
|
+
# echo "8.4293092923 48.9896114523" | cs2cs -f '%.10f' +init=epsg:4326 +to +init=epsg:31467 -
|
47
|
+
def test_wgs84_to_gk_forward
|
48
|
+
transform = Proj::Transformation.new(@crs_wgs84, @crs_gk)
|
49
|
+
from = Proj::Coordinate.new(lam: 48.9906726079, phi: 8.4302123334)
|
50
|
+
to = transform.forward(from)
|
51
|
+
|
52
|
+
assert_in_delta(5428307, to.x, PRECISION)
|
53
|
+
assert_in_delta(3458375, to.y, PRECISION)
|
54
|
+
assert_in_delta(0, to.z, PRECISION)
|
55
|
+
assert_in_delta(0, to.t, PRECISION)
|
56
|
+
end
|
57
|
+
|
58
|
+
def test_wgs84_to_gk_forward_inverse
|
59
|
+
transform = Proj::Transformation.new(@crs_wgs84, @crs_gk)
|
60
|
+
from = Proj::Coordinate.new(x: 5428192.0, y: 3458305.0, z: -5.1790915237)
|
61
|
+
to = transform.inverse(from)
|
62
|
+
|
63
|
+
assert_in_delta(48.98963932450735, to.x, PRECISION)
|
64
|
+
assert_in_delta(8.429263044355544, to.y, PRECISION)
|
65
|
+
assert_in_delta(-5.1790915237, to.z, PRECISION)
|
66
|
+
assert_in_delta(0, to.t, PRECISION)
|
67
|
+
end
|
68
|
+
end
|
data/test/unit_test.rb
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
require_relative './abstract_test'
|
4
|
+
|
5
|
+
class UnitsTest < AbstractTest
|
6
|
+
def test_get_all
|
7
|
+
units = Proj::Unit.list.sort.collect {|unit| unit.id}
|
8
|
+
assert(units.include?('deg'))
|
9
|
+
assert(units.include?('km'))
|
10
|
+
assert(units.include?('m'))
|
11
|
+
assert(units.include?('yd'))
|
12
|
+
assert(units.include?('us-mi'))
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_linear_unit
|
16
|
+
unit = Proj::Unit.get('km')
|
17
|
+
assert_kind_of Proj::Unit, unit
|
18
|
+
assert_equal('km', unit.id)
|
19
|
+
assert_equal('km', unit.to_s)
|
20
|
+
assert_equal('1000', unit.to_meter)
|
21
|
+
assert_equal(1000.0, unit.factor)
|
22
|
+
assert_equal('Kilometer', unit.name)
|
23
|
+
assert_equal('#<Proj::Unit id="km", to_meter="1000", factor="1000.0", name="Kilometer">', unit.inspect)
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_angular_unit
|
27
|
+
unit = Proj::Unit.get('deg')
|
28
|
+
assert_kind_of Proj::Unit, unit
|
29
|
+
assert_equal('deg', unit.id)
|
30
|
+
assert_equal('deg', unit.to_s)
|
31
|
+
assert_equal('0.017453292519943296', unit.to_meter)
|
32
|
+
assert_equal(0.017453292519943295, unit.factor)
|
33
|
+
assert_equal('Degree', unit.name)
|
34
|
+
assert_equal('#<Proj::Unit id="deg", to_meter="0.017453292519943296", factor="0.017453292519943295", name="Degree">', unit.inspect)
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_compare
|
38
|
+
u1 = Proj::Unit.get('km')
|
39
|
+
u2 = Proj::Unit.get('km')
|
40
|
+
assert(u1 == u2)
|
41
|
+
end
|
42
|
+
|
43
|
+
def test_failed_get
|
44
|
+
unit = Proj::Unit.get('foo')
|
45
|
+
assert_nil unit
|
46
|
+
end
|
47
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: proj4rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guilhem Vellut
|
@@ -10,73 +10,91 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
14
|
-
dependencies:
|
15
|
-
|
16
|
-
|
13
|
+
date: 2019-12-31 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: ffi
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - ">="
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '0'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: minitest
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - ">="
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: '0'
|
36
|
+
type: :development
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - ">="
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: '0'
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: yard
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: '0'
|
50
|
+
type: :development
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '0'
|
57
|
+
description: " Proj4rb is a ruby binding for the Proj.4 Carthographic Projection
|
58
|
+
library, that supports conversions between a very large number of geographic coordinate
|
59
|
+
systems and datumspec.\n"
|
17
60
|
email:
|
18
61
|
executables: []
|
19
|
-
extensions:
|
20
|
-
- ext/extconf.rb
|
62
|
+
extensions: []
|
21
63
|
extra_rdoc_files: []
|
22
64
|
files:
|
65
|
+
- ChangeLog
|
66
|
+
- Gemfile
|
23
67
|
- MIT-LICENSE
|
24
68
|
- README.rdoc
|
25
69
|
- Rakefile
|
26
|
-
-
|
27
|
-
-
|
28
|
-
-
|
29
|
-
-
|
30
|
-
-
|
31
|
-
-
|
32
|
-
-
|
33
|
-
-
|
34
|
-
-
|
35
|
-
-
|
36
|
-
-
|
37
|
-
-
|
38
|
-
- data/nad27
|
39
|
-
- data/nad83
|
40
|
-
- data/ntv1_can.dat
|
41
|
-
- data/null
|
42
|
-
- data/other.extra
|
43
|
-
- data/proj_def.dat
|
44
|
-
- data/prvi
|
45
|
-
- data/stgeorge
|
46
|
-
- data/stlrnc
|
47
|
-
- data/stpaul
|
48
|
-
- data/world
|
49
|
-
- example/basic.rb
|
50
|
-
- example/list-datums.rb
|
51
|
-
- example/list-ellipsoids.rb
|
52
|
-
- example/list-errors.rb
|
53
|
-
- example/list-prime-meridians.rb
|
54
|
-
- example/list-projection-types.rb
|
55
|
-
- example/list-units.rb
|
56
|
-
- example/version.rb
|
57
|
-
- ext/Makefile
|
58
|
-
- ext/extconf.rb
|
59
|
-
- ext/mkmf.log
|
60
|
-
- ext/out.log
|
61
|
-
- ext/proj4_ruby-x64-mingw32.def
|
62
|
-
- ext/proj4_ruby.so
|
63
|
-
- ext/projrb.c
|
64
|
-
- ext/projrb.o
|
65
|
-
- ext/vc/proj4_ruby.sln
|
66
|
-
- ext/vc/proj4_ruby.vcproj
|
70
|
+
- lib/area.rb
|
71
|
+
- lib/config.rb
|
72
|
+
- lib/context.rb
|
73
|
+
- lib/coordinate.rb
|
74
|
+
- lib/crs.rb
|
75
|
+
- lib/ellipsoid.rb
|
76
|
+
- lib/error.rb
|
77
|
+
- lib/operation.rb
|
78
|
+
- lib/pj_object.rb
|
79
|
+
- lib/point.rb
|
80
|
+
- lib/prime_meridian.rb
|
81
|
+
- lib/proj.rb
|
67
82
|
- lib/proj4.rb
|
68
|
-
-
|
69
|
-
-
|
70
|
-
-
|
71
|
-
-
|
72
|
-
- test/
|
73
|
-
- test/
|
74
|
-
- test/
|
75
|
-
- test/
|
76
|
-
- test/
|
77
|
-
- test/
|
78
|
-
- test/
|
79
|
-
- test/
|
83
|
+
- lib/projection.rb
|
84
|
+
- lib/transformation.rb
|
85
|
+
- lib/unit.rb
|
86
|
+
- proj4rb.gemspec
|
87
|
+
- test/abstract_test.rb
|
88
|
+
- test/context_test.rb
|
89
|
+
- test/coordinate_test.rb
|
90
|
+
- test/crs_test.rb
|
91
|
+
- test/ellipsoid_test.rb
|
92
|
+
- test/operation_test.rb
|
93
|
+
- test/prime_meridians_test.rb
|
94
|
+
- test/proj_test.rb
|
95
|
+
- test/projection_test.rb
|
96
|
+
- test/transformation_test.rb
|
97
|
+
- test/unit_test.rb
|
80
98
|
homepage: https://github.com/cfis/proj4rb
|
81
99
|
licenses:
|
82
100
|
- MIT
|
@@ -89,29 +107,16 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
89
107
|
requirements:
|
90
108
|
- - ">="
|
91
109
|
- !ruby/object:Gem::Version
|
92
|
-
version:
|
110
|
+
version: 2.4.9
|
93
111
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
94
112
|
requirements:
|
95
113
|
- - ">="
|
96
114
|
- !ruby/object:Gem::Version
|
97
115
|
version: '0'
|
98
116
|
requirements:
|
99
|
-
- Proj
|
100
|
-
|
101
|
-
rubygems_version: 2.4.5
|
117
|
+
- Proj (Proj4) Library
|
118
|
+
rubygems_version: 3.0.6
|
102
119
|
signing_key:
|
103
120
|
specification_version: 4
|
104
121
|
summary: Ruby bindings for the Proj.4 Carthographic Projection library
|
105
|
-
test_files:
|
106
|
-
- test/test_constants.rb
|
107
|
-
- test/test_create_projection.rb
|
108
|
-
- test/test_datums.rb
|
109
|
-
- test/test_ellipsoids.rb
|
110
|
-
- test/test_errors.rb
|
111
|
-
- test/test_init_projection.rb
|
112
|
-
- test/test_prime_meridians.rb
|
113
|
-
- test/test_projection_type.rb
|
114
|
-
- test/test_simple_projection.rb
|
115
|
-
- test/test_suite.rb
|
116
|
-
- test/test_transform.rb
|
117
|
-
- test/test_units.rb
|
122
|
+
test_files: []
|