geoutm 0.0.4

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.
data/spec/utm_spec.rb ADDED
@@ -0,0 +1,48 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ module GeoUtm
4
+ # http://rspec.info/
5
+ describe UTM do
6
+ before :each do
7
+ # some random points
8
+ @p1 = UTM.new '60J', 484713.786930711, 7128217.21692427, Ellipsoid::lookup('Bessel 1841 Nambia')
9
+ @p2 = UTM.new '27E', 646897.012158895, 3049077.01849759, Ellipsoid::lookup(:airy)
10
+ @p3 = UTM.new '37T', 581477.812337138, 5020289.06897684, Ellipsoid::lookup('bessel 1841')
11
+ @p4 = UTM.new '37T', 677938.186800496, 5048262.27080925, Ellipsoid::lookup('bessel 1841')
12
+ end
13
+
14
+ it "should calculate distance between points" do
15
+ @p3.distance_to(@p4).should be_close(100434.575034537, 0.0001)
16
+ @p4.distance_to(@p3).should be_close(100434.575034537, 0.0001)
17
+ @p4.distance_to(@p4).should be_close(0.0, 0.0001)
18
+ end
19
+
20
+ it "should not calculate distances between different zones" do
21
+ lambda {@p1.distance_to(@p4)}.should raise_error
22
+ end
23
+
24
+ it "should calculate distance to LatLon coordinate" do
25
+ @p3.distance_to(@p4.to_lat_lon).should be_close(100434.575034537, 0.001)
26
+ end
27
+
28
+ it 'should format as string' do
29
+ @p1.to_s.should == '60J 484713.79 7128217.22'
30
+ end
31
+
32
+ it 'should not accept invalid zone letters' do
33
+ lambda {UTM::split_zone '56Y'}.should raise_error
34
+ lambda {UTM::split_zone '56I'}.should raise_error
35
+ lambda {UTM::split_zone '56O'}.should raise_error
36
+ lambda {UTM::split_zone '56A'}.should raise_error
37
+ end
38
+
39
+ it 'should not accept invalid zone numbers' do
40
+ lambda {UTM::split_zone '00C'}.should raise_error
41
+ lambda {UTM::split_zone '61C'}.should raise_error
42
+ end
43
+
44
+ it 'should accept valid UTM zones' do
45
+ lambda {UTM::split_zone '51C'}.should_not raise_error
46
+ end
47
+ end
48
+ end
metadata ADDED
@@ -0,0 +1,89 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: geoutm
3
+ version: !ruby/object:Gem::Version
4
+ prerelease: false
5
+ segments:
6
+ - 0
7
+ - 0
8
+ - 4
9
+ version: 0.0.4
10
+ platform: ruby
11
+ authors:
12
+ - Tallak Tveide
13
+ autorequire:
14
+ bindir: bin
15
+ cert_chain: []
16
+
17
+ date: 2010-05-24 00:00:00 +02:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: rspec
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ">="
26
+ - !ruby/object:Gem::Version
27
+ segments:
28
+ - 0
29
+ version: "0"
30
+ type: :development
31
+ version_requirements: *id001
32
+ description: Conversion between latitude and longitude coordinates and UTM coordiantes
33
+ email:
34
+ - tallak@tveide.net
35
+ executables: []
36
+
37
+ extensions: []
38
+
39
+ extra_rdoc_files:
40
+ - README.rdoc
41
+ files:
42
+ - spec/utm_spec.rb
43
+ - spec/spec.opts
44
+ - spec/latlon_spec.rb
45
+ - spec/geoutm_spec.rb
46
+ - spec/ellipsoid_spec.rb
47
+ - spec/spec_helper.rb
48
+ - spec/testdata.yaml
49
+ - lib/geoutm/utm.rb
50
+ - lib/geoutm/latlon.rb
51
+ - lib/geoutm/constants.rb
52
+ - lib/geoutm/ellipsoid.rb
53
+ - lib/geoutm.rb
54
+ - LICENCE
55
+ - README.rdoc
56
+ - History.txt
57
+ has_rdoc: true
58
+ homepage: http://www.github.com/tallakt/geoutm
59
+ licenses: []
60
+
61
+ post_install_message:
62
+ rdoc_options:
63
+ - --main
64
+ - README.rdoc
65
+ require_paths:
66
+ - - lib
67
+ required_ruby_version: !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ segments:
72
+ - 0
73
+ version: "0"
74
+ required_rubygems_version: !ruby/object:Gem::Requirement
75
+ requirements:
76
+ - - ">="
77
+ - !ruby/object:Gem::Version
78
+ segments:
79
+ - 0
80
+ version: "0"
81
+ requirements: []
82
+
83
+ rubyforge_project: geoutm
84
+ rubygems_version: 1.3.6
85
+ signing_key:
86
+ specification_version: 3
87
+ summary: Converting map coordinates
88
+ test_files: []
89
+