proj4rb 2.2.1 → 2.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,68 +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(5428306.39, 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(5428306.39, 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
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(5428306.39, 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(5428306.39, 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
68
  end
@@ -1,47 +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
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: 2.2.1
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guilhem Vellut
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-01-09 00:00:00.000000000 Z
13
+ date: 2020-01-10 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ffi