proj4rb 0.3.0-x86-mswin32-60

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. data/MIT-LICENSE +9 -0
  2. data/README +169 -0
  3. data/data/GL27 +22 -0
  4. data/data/MD +0 -0
  5. data/data/TN +0 -0
  6. data/data/WI +0 -0
  7. data/data/WO +0 -0
  8. data/data/conus +0 -0
  9. data/data/epsg +5443 -0
  10. data/data/epsg-deprecated +2 -0
  11. data/data/esri +5937 -0
  12. data/data/esri.extra +948 -0
  13. data/data/hawaii +0 -0
  14. data/data/nad.lst +142 -0
  15. data/data/nad27 +809 -0
  16. data/data/nad83 +744 -0
  17. data/data/ntv1_can.dat +0 -0
  18. data/data/null +0 -0
  19. data/data/other.extra +49 -0
  20. data/data/proj_def.dat +17 -0
  21. data/data/prvi +0 -0
  22. data/data/stgeorge +0 -0
  23. data/data/stlrnc +0 -0
  24. data/data/stpaul +0 -0
  25. data/data/world +212 -0
  26. data/example/basic.rb +18 -0
  27. data/example/list-datums.rb +17 -0
  28. data/example/list-ellipsoids.rb +17 -0
  29. data/example/list-errors.rb +11 -0
  30. data/example/list-prime-meridians.rb +17 -0
  31. data/example/list-projection-types.rb +17 -0
  32. data/example/list-units.rb +17 -0
  33. data/example/version.rb +8 -0
  34. data/ext/extconf.rb +8 -0
  35. data/ext/mingw/rakefile.rb +38 -0
  36. data/ext/projrb.c +560 -0
  37. data/ext/vc/proj4_ruby.sln +19 -0
  38. data/ext/vc/proj4_ruby.vcproj +208 -0
  39. data/lib/proj4.rb +466 -0
  40. data/lib/proj4_ruby.so +0 -0
  41. data/rakefile.rb +130 -0
  42. data/test/test_constants.rb +20 -0
  43. data/test/test_create_projection.rb +64 -0
  44. data/test/test_datums.rb +44 -0
  45. data/test/test_ellipsoids.rb +45 -0
  46. data/test/test_errors.rb +70 -0
  47. data/test/test_init_projection.rb +108 -0
  48. data/test/test_prime_meridians.rb +44 -0
  49. data/test/test_projection_type.rb +43 -0
  50. data/test/test_simple_projection.rb +57 -0
  51. data/test/test_transform.rb +114 -0
  52. data/test/test_units.rb +45 -0
  53. metadata +117 -0
@@ -0,0 +1,114 @@
1
+ $: << 'lib' << 'ext'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'proj4')
3
+ require 'test/unit'
4
+
5
+ class TransformTest < Test::Unit::TestCase
6
+
7
+ PRECISION = 0.1 ** 8
8
+
9
+ def setup
10
+ @proj_wgs84 = Proj4::Projection.new(["init=epsg:4326"])
11
+ @proj_gk = Proj4::Projection.new(["init=epsg:31467"])
12
+ @proj_merc = Proj4::Projection.new(["proj=merc"])
13
+ @lon = 8.4293092923
14
+ @lat = 48.9896114523
15
+ @rw = 3458305
16
+ @hw = 5428192
17
+ @zw = -5.1790915237
18
+ end
19
+
20
+ # echo "3458305 5428192" | cs2cs -f '%.10f' +init=epsg:31467 +to +init=epsg:4326 -
21
+ def test_gk_to_wgs84
22
+ from = Proj4::Point.new(@rw, @hw, @zw)
23
+ to = @proj_gk.transform(@proj_wgs84, from)
24
+ assert_not_equal from.object_id, to.object_id
25
+ assert_in_delta @lon, to.x * Proj4::RAD_TO_DEG, PRECISION
26
+ assert_in_delta @lat, to.y * Proj4::RAD_TO_DEG, PRECISION
27
+ assert_in_delta 0, to.z, PRECISION
28
+ end
29
+
30
+ def test_gk_to_wgs84_inplace
31
+ from = Proj4::Point.new(@rw, @hw, @zw)
32
+ to = @proj_gk.transform!(@proj_wgs84, from)
33
+ assert_equal from.object_id, to.object_id
34
+ assert_in_delta @lon, to.x * Proj4::RAD_TO_DEG, PRECISION
35
+ assert_in_delta @lat, to.y * Proj4::RAD_TO_DEG, PRECISION
36
+ assert_in_delta 0, to.z, PRECISION
37
+ end
38
+
39
+ # echo "8.4293092923 48.9896114523" | cs2cs -f '%.10f' +init=epsg:4326 +to +init=epsg:31467 -
40
+ def test_wgs84_to_gk
41
+ point = @proj_wgs84.transform(@proj_gk, Proj4::Point.new(@lon * Proj4::DEG_TO_RAD, @lat * Proj4::DEG_TO_RAD, 0))
42
+ assert_equal @rw, point.x.round
43
+ assert_equal @hw, point.y.round
44
+ assert_in_delta @zw, point.z, PRECISION
45
+ end
46
+
47
+ def test_no_dst_proj
48
+ assert_raise TypeError do
49
+ point = @proj_wgs84.transform(nil, Proj4::Point.new(@lon * Proj4::DEG_TO_RAD, @lat * Proj4::DEG_TO_RAD, 0))
50
+ end
51
+ end
52
+
53
+ def test_not_a_point
54
+ assert_raise TypeError do
55
+ point = @proj_wgs84.transform(@proj_gk, nil)
56
+ end
57
+ end
58
+
59
+ def test_mercator_at_pole_raise
60
+ assert_raise Proj4::ToleranceConditionError do
61
+ point = @proj_wgs84.transform(@proj_merc, Proj4::Point.new(0, 90 * Proj4::DEG_TO_RAD, 0))
62
+ end
63
+ end
64
+
65
+ def test_mercator_at_pole_rescue
66
+ begin
67
+ point = @proj_wgs84.transform(@proj_merc, Proj4::Point.new(0, 90 * Proj4::DEG_TO_RAD, 0))
68
+ rescue => exception
69
+ assert_kind_of Proj4::ToleranceConditionError, exception
70
+ assert_equal 'tolerance condition error', exception.message
71
+ assert_equal 20, exception.errnum
72
+ end
73
+ end
74
+
75
+ class XYPoint
76
+ attr_accessor :x, :y, :extra
77
+ def initialize(x, y, extra)
78
+ @x = x
79
+ @y = y
80
+ @extra = extra
81
+ end
82
+ end
83
+ def test_no_z
84
+ point = @proj_gk.transform(@proj_wgs84, XYPoint.new(@rw, @hw, 'foo') )
85
+ assert_kind_of XYPoint, point
86
+ assert_equal 'foo', point.extra
87
+ assert_in_delta @lon, point.x * Proj4::RAD_TO_DEG, PRECISION
88
+ assert_in_delta @lat, point.y * Proj4::RAD_TO_DEG, PRECISION
89
+ end
90
+
91
+ def test_no_float
92
+ assert_raise TypeError do
93
+ @proj_gk.transform(@proj_wgs84, XYPoint.new('x', 'y', 'foo') )
94
+ end
95
+ end
96
+
97
+ def test_syscallerr
98
+ # we need a test here that checks whether transform() properly returns a SystemCallError exception
99
+ end
100
+
101
+ def test_collection
102
+ from0 = Proj4::Point.new(@rw, @hw, @zw)
103
+ from1 = Proj4::Point.new(0, 0, 0)
104
+ collection = @proj_gk.transform_all!(@proj_wgs84, [from0, from1])
105
+ to0 = collection[0]
106
+ to1 = collection[1]
107
+ assert_equal from1.object_id, to1.object_id
108
+ assert_in_delta @lon, to0.x * Proj4::RAD_TO_DEG, PRECISION
109
+ assert_in_delta @lat, to0.y * Proj4::RAD_TO_DEG, PRECISION
110
+ assert_in_delta 0, to0.z, PRECISION
111
+ end
112
+
113
+ end
114
+
@@ -0,0 +1,45 @@
1
+ $: << 'lib' << 'ext'
2
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'proj4')
3
+ require 'test/unit'
4
+
5
+ if Proj4::LIBVERSION >= 449
6
+ class UnitsTest < Test::Unit::TestCase
7
+
8
+ def test_get_all
9
+ units = Proj4::Unit.list.sort.collect{ |u| u.id }
10
+ assert units.index('km')
11
+ assert units.index('m')
12
+ assert units.index('yd')
13
+ assert units.index('us-mi')
14
+ end
15
+
16
+ def test_one
17
+ unit = Proj4::Unit.get('km')
18
+ assert_kind_of Proj4::Unit, unit
19
+ assert_equal 'km', unit.id
20
+ assert_equal 'km', unit.to_s
21
+ assert_equal '1000.', unit.to_meter
22
+ assert_equal 'Kilometer', unit.name
23
+ assert_equal '#<Proj4::Unit id="km", to_meter="1000.", name="Kilometer">', unit.inspect
24
+ end
25
+
26
+ def test_compare
27
+ u1 = Proj4::Unit.get('km')
28
+ u2 = Proj4::Unit.get('km')
29
+ assert u1 == u2
30
+ end
31
+
32
+ def test_failed_get
33
+ unit = Proj4::Unit.get('foo')
34
+ assert_nil unit
35
+ end
36
+
37
+ def test_new
38
+ assert_raise TypeError do
39
+ Proj4::Unit.new
40
+ end
41
+ end
42
+
43
+ end
44
+ end
45
+
metadata ADDED
@@ -0,0 +1,117 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: proj4rb
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.3.0
5
+ platform: x86-mswin32-60
6
+ authors:
7
+ - Guilhem Vellut
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2008-08-21 00:00:00 -06:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: Proj4rb is a ruby binding for the Proj.4 Carthographic Projection library, that supports conversions between a very large number of geographic coordinate systems and datums.
17
+ email: guilhem.vellut@gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README
24
+ files:
25
+ - rakefile.rb
26
+ - README
27
+ - MIT-LICENSE
28
+ - data/conus
29
+ - data/epsg
30
+ - data/epsg-deprecated
31
+ - data/esri
32
+ - data/esri.extra
33
+ - data/GL27
34
+ - data/hawaii
35
+ - data/MD
36
+ - data/nad.lst
37
+ - data/nad27
38
+ - data/nad83
39
+ - data/ntv1_can.dat
40
+ - data/null
41
+ - data/other.extra
42
+ - data/proj_def.dat
43
+ - data/prvi
44
+ - data/stgeorge
45
+ - data/stlrnc
46
+ - data/stpaul
47
+ - data/TN
48
+ - data/WI
49
+ - data/WO
50
+ - data/world
51
+ - example/basic.rb
52
+ - example/list-datums.rb
53
+ - example/list-ellipsoids.rb
54
+ - example/list-errors.rb
55
+ - example/list-prime-meridians.rb
56
+ - example/list-projection-types.rb
57
+ - example/list-units.rb
58
+ - example/version.rb
59
+ - ext/extconf.rb
60
+ - ext/mingw
61
+ - ext/projrb.c
62
+ - ext/vc
63
+ - ext/mingw/rakefile.rb
64
+ - ext/vc/proj4_ruby.sln
65
+ - ext/vc/proj4_ruby.vcproj
66
+ - lib/proj4.rb
67
+ - test/test_constants.rb
68
+ - test/test_create_projection.rb
69
+ - test/test_datums.rb
70
+ - test/test_ellipsoids.rb
71
+ - test/test_errors.rb
72
+ - test/test_init_projection.rb
73
+ - test/test_prime_meridians.rb
74
+ - test/test_projection_type.rb
75
+ - test/test_simple_projection.rb
76
+ - test/test_transform.rb
77
+ - test/test_units.rb
78
+ - lib/proj4_ruby.so
79
+ has_rdoc: true
80
+ homepage: http://proj4rb.rubyforge.org/
81
+ post_install_message:
82
+ rdoc_options:
83
+ - --main
84
+ - README
85
+ require_paths:
86
+ - lib
87
+ required_ruby_version: !ruby/object:Gem::Requirement
88
+ requirements:
89
+ - - ">="
90
+ - !ruby/object:Gem::Version
91
+ version: 1.8.4
92
+ version:
93
+ required_rubygems_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: "0"
98
+ version:
99
+ requirements:
100
+ - Proj.4 C library
101
+ rubyforge_project: proj4rb
102
+ rubygems_version: 1.2.0
103
+ signing_key:
104
+ specification_version: 2
105
+ summary: Ruby bindings for the Proj.4 Carthographic Projection library
106
+ test_files:
107
+ - test/test_constants.rb
108
+ - test/test_create_projection.rb
109
+ - test/test_datums.rb
110
+ - test/test_ellipsoids.rb
111
+ - test/test_errors.rb
112
+ - test/test_init_projection.rb
113
+ - test/test_prime_meridians.rb
114
+ - test/test_projection_type.rb
115
+ - test/test_simple_projection.rb
116
+ - test/test_transform.rb
117
+ - test/test_units.rb