geoutm 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc ADDED
@@ -0,0 +1,148 @@
1
+ =NAME
2
+
3
+ GeoUtm
4
+
5
+ =SYNOPSIS
6
+
7
+ require 'geoutm'
8
+
9
+ coordinate = LatLon.new 100.0 100.0
10
+ utm_coord = coordinate.to_utm
11
+ reverse = utm_coord.to_lat_lon
12
+
13
+ =INSTALL
14
+
15
+ sudo gem sources -a http://gems.github.com
16
+ sudo gem install tallakt-geoutm
17
+
18
+
19
+ =DESCRIPTION
20
+
21
+ This module will translate latitude longitude coordinates to Universal Transverse Mercator(UTM) coordinates and vice versa.
22
+
23
+ This is a shameless port of the Perl library Geo::Coordinates::UTM written by Graham Crookham. Most text is copied directly from this library, adapted to ruby syntax.
24
+
25
+
26
+ == Mercator Projection
27
+
28
+ The Mercator projection was first invented to help mariners. They needed to be able to take a course and know the distance traveled, and draw a line on the map which showed the day's journey. In order to do this, Mercator invented a projection which preserved length, by projecting the earth's surface onto a cylinder, sharing the same axis as the earth itself.
29
+ This caused all Latitude and Longitude lines to intersect at a 90 degree angle, thereby negating the problem that longitude lines get closer together at the poles.
30
+
31
+ == Transverse Mercator Projection
32
+
33
+ A Transverse Mercator projection takes the cylinder and turns it on its side. Now the cylinder's axis passes through the equator, and it can be rotated to line up with the area of interest. Many countries use Transverse Mercator for their grid systems.
34
+
35
+ == Universal Transverse Mercator
36
+
37
+ The Universal Transverse Mercator(UTM) system sets up a universal world wide system for mapping. The Transverse Mercator projection is used, with the cylinder in 60 positions. This creates 60 zones around the world.
38
+ Positions are measured using Eastings and Northings, measured in meters, instead of Latitude and Longitude. Eastings start at 500,000 on the centre line of each zone.
39
+ In the Northern Hemisphere, Northings are zero at the equator and increase northward. In the Southern Hemisphere, Northings start at 10 million at the equator, and decrease southward. You must know which hemisphere and zone you are in to interpret your location globally.
40
+ Distortion of scale, distance, direction and area increase away from the central meridian.
41
+
42
+ UTM projection is used to define horizontal positions world-wide by dividing the surface of the Earth into 6 degree zones, each mapped by the Transverse Mercator projection with a central meridian in the center of the zone.
43
+ UTM zone numbers designate 6 degree longitudinal strips extending from 80 degrees South latitude to 84 degrees North latitude. UTM zone characters designate 8 degree zones extending north and south from the equator. Eastings are measured from the central meridian (with a 500 km false easting to insure positive coordinates). Northings are measured from the equator (with a 10,000 km false northing for positions south of the equator).
44
+
45
+ UTM is applied separately to the Northern and Southern Hemisphere, thus within a single UTM zone, a single X / Y pair of values will occur in both the Northern and Southern Hemisphere.
46
+ To eliminate this confusion, and to speed location of points, a UTM zone is sometimes subdivided into 20 zones of Latitude. These grids can be further subdivided into 100,000 meter grid squares with double-letter designations. This subdivision by Latitude and further division into grid squares is generally referred to as the Military Grid Reference System (MGRS).
47
+ The unit of measurement of UTM is always meters and the zones are numbered from 1 to 60 eastward, beginning at the 180th meridian.
48
+ The scale distortion in a north-south direction parallel to the central meridian (CM) is constant However, the scale distortion increases either direction away from the CM. To equalize the distortion of the map across the UTM zone, a scale factor of 0.9996 is applied to all distance measurements within the zone. The distortion at the zone boundary, 3 degrees away from the CM is approximately 1%.
49
+
50
+ == Datums and Ellipsoids
51
+
52
+ Unlike local surveys, which treat the Earth as a plane, the precise determination of the latitude and longitude of points over a broad area must take into account the actual shape of the Earth. To achieve the precision necessary for accurate location, the Earth cannot be assumed to be a sphere. Rather, the Earth's shape more closely approximates an ellipsoid (oblate spheroid): flattened at the poles and bulging at the Equator. Thus the Earth's shape, when cut through its polar axis, approximates an ellipse.
53
+ A "Datum" is a standard representation of shape and offset for coordinates, which includes an ellipsoid and an origin. You must consider the Datum when working with geospatial data, since data with two different Datum will not line up. The difference can be as much as a kilometer!
54
+
55
+ = EXAMPLES
56
+
57
+ A description of the available ellipsoids and sample usage of the conversion routines follows
58
+
59
+ == Ellipsoids
60
+
61
+ The Ellipsoids available are as follows:
62
+
63
+
64
+ 1. Airy
65
+ 2. Australian National
66
+ 3. Bessel 1841
67
+ 4. Bessel 1841 Nambia
68
+ 5. Clarke 1866
69
+ 6. Clarke 1880
70
+ 7. Everest 1830 India
71
+ 8. Everest 1830 Malaysia
72
+ 9. Everest 1956 India
73
+ 10. Everest 1964 Malaysia and Singapore
74
+ 11. Everest 1969 Malaysia
75
+ 12. Everest Pakistan
76
+ 13. Fischer 1960 Mercury
77
+ 14. Fischer 1968
78
+ 15. GRS 1967
79
+ 16. GRS 1980
80
+ 17. Helmert 1906
81
+ 18. Hough
82
+ 19. Indonesian 1974
83
+ 20. International
84
+ 21. Krassovsky
85
+ 22. Modified Airy
86
+ 23. Modified Everest
87
+ 24. Modified Fischer 1960
88
+ 25. South American 1969
89
+ 26. WGS 60
90
+ 27. WGS 66
91
+ 28. WGS-72
92
+ 29. WGS-84
93
+
94
+
95
+ == ellipsoid_names
96
+
97
+ The ellipsoids can be accessed using
98
+
99
+ GeoUtm::Ellipsoid::list_names
100
+
101
+ Alternatively
102
+
103
+ GeouUtm::Ellipsoid::each {|ellipsoid| ... }
104
+
105
+ When converting to and from UTM coordinates, the ellipsoid
106
+ is specified as a parameter which defaults to WGS-84. To use another
107
+ ellipsoid, use
108
+
109
+ coord.to_utm Ellipsoid::lookup :wgs60
110
+
111
+ The name is not case sensitive and symbols are allowed. Spaces and -
112
+ are ignored.
113
+
114
+ == Latitude / longitude to UTM conversion
115
+
116
+ Latitude values in the southern hemisphere should be supplied as negative values (e.g. 30 deg South will be -30). Similarly Longitude values West of the meridian should also be supplied as negative values. Both latitude and longitude should not be entered as deg,min,sec but as their decimal equivalent, e.g. 30 deg 12 min 22.432 sec should be entered as 30.2062311
117
+
118
+ The ellipsoid value should correspond to one of the numbers above, e.g. to use WGS-84, the ellipsoid value should be 23
119
+
120
+ For latitude 57deg 49min 59.000sec North
121
+ longitude 02deg 47min 20.226sec West
122
+
123
+ using Clarke 1866 (Ellipsoid 5)
124
+
125
+ utm = LatLon.new(57.803055556, -2.788951667).to_utm(Ellipsoid::lookup('clarke 1866'))
126
+
127
+ returns
128
+
129
+ utm.zone = 30V
130
+ utm.e = 512533.364651484
131
+ utm.n = 6409932.13416127
132
+
133
+
134
+ == AUTHOR
135
+
136
+ Graham Crookham, grahamc@cpan.org
137
+
138
+ Ruby port by Tallak Tveide 2009
139
+
140
+ == COPYRIGHT
141
+
142
+ Copyright (c) 2000,2002,2004 by Graham Crookham. All rights reserved.
143
+
144
+ This package is free software; you can redistribute it
145
+ and/or modify it under the same terms as Perl itself.
146
+
147
+
148
+
@@ -0,0 +1,4 @@
1
+ module GeoUtm
2
+ Deg2Rad = Math::PI / 180.0
3
+ Rad2Deg = 180.0 / Math::PI
4
+ end
@@ -0,0 +1,75 @@
1
+ module GeoUtm
2
+ class Ellipsoid
3
+ attr_reader :name, :radius, :eccentricity
4
+
5
+
6
+ def initialize(name, radius, eccentricity)
7
+ @name, @radius, @eccentricity = name, radius, eccentricity
8
+ end
9
+
10
+ def Ellipsoid.lookup(name)
11
+ List[normalize_name(name.to_s)]
12
+ end
13
+
14
+ def Ellipsoid.list_names
15
+ List.keys.sort.map do |k|
16
+ List[k].name
17
+ end
18
+ end
19
+
20
+ def Ellipsoid.each
21
+ List.keys.sort do |k|
22
+ yield List[k]
23
+ end
24
+ end
25
+
26
+ private
27
+
28
+ def Ellipsoid.normalize_name(name)
29
+ name.gsub(/[\s\-\(\)]/, '').upcase
30
+ end
31
+
32
+ def Ellipsoid.generate_list
33
+ result = {}
34
+ data = [
35
+ [ "Airy", 6377563, 0.00667054],
36
+ [ "Australian National", 6378160, 0.006694542],
37
+ [ "Bessel 1841", 6377397, 0.006674372],
38
+ [ "Bessel 1841 Nambia", 6377484, 0.006674372],
39
+ [ "Clarke 1866", 6378206, 0.006768658],
40
+ [ "Clarke 1880", 6378249, 0.006803511],
41
+ [ "Everest 1830 India", 6377276, 0.006637847],
42
+ [ "Fischer 1960 Mercury", 6378166, 0.006693422],
43
+ [ "Fischer 1968", 6378150, 0.006693422],
44
+ [ "GRS 1967", 6378160, 0.006694605],
45
+ [ "GRS 1980", 6378137, 0.00669438],
46
+ [ "Helmert 1906", 6378200, 0.006693422],
47
+ [ "Hough", 6378270, 0.00672267],
48
+ [ "International", 6378388, 0.00672267],
49
+ [ "Krassovsky", 6378245, 0.006693422],
50
+ [ "Modified Airy", 6377340, 0.00667054],
51
+ [ "Modified Everest", 6377304, 0.006637847],
52
+ [ "Modified Fischer 1960", 6378155, 0.006693422],
53
+ [ "South American 1969", 6378160, 0.006694542],
54
+ [ "WGS 60", 6378165, 0.006693422],
55
+ [ "WGS 66", 6378145, 0.006694542],
56
+ [ "WGS-72", 6378135, 0.006694318],
57
+ [ "WGS-84", 6378137, 0.00669438 ],
58
+ [ "Everest 1830 Malaysia", 6377299, 0.006637847],
59
+ [ "Everest 1956 India", 6377301, 0.006637847],
60
+ [ "Everest 1964 Malaysia and Singapore", 6377304, 0.006637847],
61
+ [ "Everest 1969 Malaysia", 6377296, 0.006637847],
62
+ [ "Everest Pakistan", 6377296, 0.006637534],
63
+ [ "Indonesian 1974", 6378160, 0.006694609],
64
+ ]
65
+ data.each do |item|
66
+ el = Ellipsoid.new *item
67
+ result[normalize_name(el.name)] = el
68
+ end
69
+ result
70
+ end
71
+
72
+ List = Ellipsoid::generate_list
73
+ end
74
+
75
+ end
@@ -0,0 +1,136 @@
1
+ require 'geoutm/constants'
2
+ require 'geoutm/ellipsoid'
3
+ require 'geoutm/utm'
4
+
5
+ module GeoUtm
6
+ class LatLon
7
+ include Math
8
+ attr_reader :lat, :lon
9
+
10
+ def initialize(lat, lon)
11
+ throw RuntimeException.new("Invalid longitude #{lon}") unless (-180.0...180.0).member? lon
12
+ @lat, @lon = lat, lon
13
+ end
14
+
15
+ def to_s
16
+ north_south = if @lat >= 0.0 then 'N' else 'S' end
17
+ east_west = if @lon >= 0.0 then 'E' else 'W' end
18
+ '%0.6f%s %0.6f%s' % [@lat.abs, north_south, @lon.abs, east_west]
19
+ end
20
+
21
+ def to_utm(ellipsoid = Ellipsoid::lookup(:wgs84), zone = nil)
22
+ lat_radian = Deg2Rad * @lat
23
+ long_radian = Deg2Rad * long2
24
+
25
+ k0 = 0.9996 # scale
26
+
27
+ if zone
28
+ zn, zl = UTM::split_zone zone
29
+ else
30
+ zn = calc_utm_zone_number
31
+ zl = calc_utm_zone_letter
32
+ end
33
+
34
+ eccentricity = ellipsoid.eccentricity
35
+ longorigin = (zn - 1) * 6 - 180 + 3
36
+ longoriginradian = Deg2Rad * longorigin
37
+ eccentprime = ellipsoid.eccentricity/(1.0-eccentricity)
38
+
39
+ n = ellipsoid.radius / sqrt(1 - eccentricity * sin(lat_radian)*sin(lat_radian))
40
+ t = tan(lat_radian) * tan(lat_radian)
41
+ c = eccentprime * cos(lat_radian)*cos(lat_radian)
42
+ a = cos(lat_radian) * (long_radian - longoriginradian)
43
+ m = ellipsoid.radius * (
44
+ (1 - eccentricity/4 - 3 * eccentricity * eccentricity/64 -
45
+ 5 * eccentricity * eccentricity * eccentricity/256) * lat_radian -
46
+ (3 * eccentricity/8 + 3 * eccentricity * eccentricity/32 +
47
+ 45 * eccentricity * eccentricity * eccentricity/1024) * sin(2 * lat_radian) +
48
+ (15 * eccentricity * eccentricity/256 +
49
+ 45 * eccentricity * eccentricity * eccentricity/1024) * sin(4 * lat_radian) -
50
+ (35 * eccentricity * eccentricity * eccentricity/3072) * sin(6 * lat_radian)
51
+ )
52
+
53
+ utm_easting = k0*n*(a+(1-t+c)*a*a*a/6 + (5-18*t+t*t+72*c-58*eccentprime)*a*a*a*a*a/120) + 500000.0
54
+
55
+ utm_northing = k0 * ( m + n*tan(lat_radian) * ( a*a/2+(5-t+9*c+4*c*c)*a*a*a*a/24 +
56
+ (61-58*t+t*t+600*c-330*eccentprime) * a*a*a*a*a*a/720))
57
+ utm_northing += 10000000.0 if @lat < 0
58
+
59
+ UTM.new '%d%s' % [zn, zl], utm_easting, utm_northing, ellipsoid
60
+ end
61
+
62
+ private
63
+
64
+ def calc_utm_zone_letter
65
+ case @lat
66
+ when 72.0..84.0
67
+ 'X'
68
+ when 64.0..72.0
69
+ 'W'
70
+ when 56.0..64.0
71
+ 'V'
72
+ when 48.0..56.0
73
+ 'U'
74
+ when 40.0..48.0
75
+ 'T'
76
+ when 32.0..40.0
77
+ 'S'
78
+ when 24.0..32.0
79
+ 'R'
80
+ when 16.0..24.0
81
+ 'Q'
82
+ when 8.0..16.0
83
+ 'P'
84
+ when 0.0..8.0
85
+ 'N'
86
+ when -8.0..0.0
87
+ 'M'
88
+ when -16.0..-8.0
89
+ 'L'
90
+ when -24.0..-16.0
91
+ 'K'
92
+ when -32.0..-24.0
93
+ 'J'
94
+ when -40.0..-32.0
95
+ 'H'
96
+ when -48.0..-40.0
97
+ 'G'
98
+ when -56.0..-48.0
99
+ 'F'
100
+ when -64.0..-56.0
101
+ 'E'
102
+ when -72.0..-64.0
103
+ 'D'
104
+ when -80.0..-72.0
105
+ 'C'
106
+ else
107
+ throw RuntimeException.new("Latitude #{@lat} out of UTM range")
108
+ end
109
+ end
110
+
111
+ def long2
112
+ @lon - ((@lon + 180)/360).to_i * 360
113
+ end
114
+
115
+ def calc_utm_zone_number
116
+ zone = ((long2 + 180)/6).to_i + 1;
117
+ if (56.0..64.0).member?(@lat) && (3.0..12.0).member?(long2)
118
+ zone = 32
119
+ end
120
+
121
+ if (72.0..84.0).member? @lat
122
+ case long2
123
+ when 0.0..9.0
124
+ zone = 31
125
+ when 9.0..21.0
126
+ zone = 33
127
+ when 21.0..33.0
128
+ zone = 35
129
+ when 33.0..42.0
130
+ zone = 37
131
+ end
132
+ end
133
+ zone
134
+ end
135
+ end
136
+ end
data/lib/geoutm/utm.rb ADDED
@@ -0,0 +1,86 @@
1
+ require 'geoutm/constants'
2
+ require 'geoutm/ellipsoid'
3
+ require 'geoutm/latlon'
4
+
5
+ module GeoUtm
6
+ class UTM
7
+ include Math
8
+
9
+ attr_reader :n, :e, :zone, :zone_number, :zone_letter, :ellipsoid
10
+
11
+ def initialize(zone, e, n, ellipsoid = Ellipsoid::lookup(:wgs84))
12
+ @n, @e, @zone, @ellipsoid = n, e, zone, ellipsoid
13
+ @zone_number, @zone_letter = UTM::split_zone @zone
14
+ end
15
+
16
+ def to_s
17
+ '%s %.2f %.2f' % [zone, e, n]
18
+ end
19
+
20
+ def to_lat_lon
21
+ k0 = 0.9996
22
+ x = @e - 500000 # Remove Longitude offset
23
+ y = @n
24
+
25
+ # Set hemisphere (1=Northern, 0=Southern)
26
+ y -= 10000000.0 unless northern_hemisphere?
27
+
28
+ longorigin = (@zone_number - 1)*6 - 180 + 3
29
+ ecc = @ellipsoid.eccentricity
30
+ eccPrimeSquared = (ecc)/(1-ecc)
31
+ m = y / k0
32
+ mu = m / (@ellipsoid.radius * (1 - ecc / 4 - 3 * ecc ** 2 / 64 - 5 * ecc ** 3 / 256))
33
+ e1 = (1 - sqrt(1 - ecc)) / (1 + sqrt(1 - ecc))
34
+ phi1rad = mu +
35
+ (3 * e1 / 2 - 27 * e1 ** 3 / 32) * sin(2 * mu) +
36
+ (21 * e1 ** 2 / 16 - 55 * e1 ** 4 / 32) * sin(4 * mu) +
37
+ (151 * e1 ** 3 / 96) * sin(6 * mu)
38
+ phi1 = phi1rad * Rad2Deg
39
+ n1 = @ellipsoid.radius / sqrt(1 - ecc * sin(phi1rad) ** 2)
40
+ t1 = tan(phi1rad) ** 2
41
+ c1 = ecc * cos(phi1rad)**2
42
+ r1 = @ellipsoid.radius * (1 - ecc) / ((1 - ecc * sin(phi1rad) ** 2) ** 1.5)
43
+ d = x / (n1 * k0)
44
+ latitude = phi1rad-
45
+ (n1 * tan(phi1rad) / r1) * (d * d / 2 -
46
+ (5 + 3 * t1 + 10 * c1 - 4 * c1 * c1 - 9 * eccPrimeSquared) * d ** 4 / 24 +
47
+ (61 + 90 * t1 + 298 * c1 + 45 * t1 * t1 -
48
+ 252 * eccPrimeSquared - 3 * c1 * c1) * d ** 6 / 720)
49
+ latitude = latitude * Rad2Deg
50
+ longitude = (d - (1 + 2 * t1 + c1) * d ** 3 / 6 +
51
+ (5 - 2 * c1 + 28 * t1 - 3 * c1 * c1 + 8 * eccPrimeSquared +
52
+ 24 * t1 * t1) * d ** 5 / 120) / cos(phi1rad)
53
+ longitude = longorigin + longitude * Rad2Deg
54
+ LatLon.new latitude, longitude
55
+ end
56
+
57
+ def distance_to(other)
58
+ if other.class == LatLon
59
+ other = other.to_utm(@ellipsoid, @zone)
60
+ end
61
+ unless other.zone == @zone
62
+ throw RuntimeError.new('Cannot calc distance for points in different zones - convert first')
63
+ end
64
+ sqrt((@n - other.n) ** 2.0 + (@e - other.e) ** 2.0)
65
+ end
66
+
67
+ def UTM.split_zone(zone_in)
68
+ m = zone_in.match /^(\d+)([CDEFGHJKLMNPQRSTUVWX])$/
69
+ throw RuntimeError.new('Illegal zone: ' + zone_in) unless m
70
+ zn, zl = m[1].to_i, m[2]
71
+ throw RuntimeError.new('Illegal zone: ' + zone_in) unless (1..60).member? zn
72
+ return zn, zl
73
+ end
74
+
75
+ def UTM.validate_zone(zone_in)
76
+ UTM::split_zone zone_in # throw exception
77
+ true
78
+ end
79
+
80
+ private
81
+
82
+ def northern_hemisphere?
83
+ @zone_letter.match /[NPQRSTUVWX]/
84
+ end
85
+ end
86
+ end
data/lib/geoutm.rb ADDED
@@ -0,0 +1,9 @@
1
+ $:.unshift(File.dirname(__FILE__)) unless
2
+ $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
3
+
4
+ require 'geoutm/utm'
5
+ require 'geoutm/latlon'
6
+
7
+ module GeoUtm
8
+ VERSION = '0.0.4'
9
+ end
@@ -0,0 +1,24 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ module GeoUtm
4
+ # http://rspec.info/
5
+ describe Ellipsoid do
6
+ before :each do
7
+ @wgs84 = Ellipsoid::lookup('WGS-84')
8
+ end
9
+
10
+ it 'should perform lookup with different case' do
11
+ Ellipsoid::lookup('Wgs-84').should be(@wgs84)
12
+ Ellipsoid::lookup('wgs-84').should be(@wgs84)
13
+ end
14
+
15
+ it 'should perform lookup ignoring space and -' do
16
+ Ellipsoid::lookup('WGS84').should be(@wgs84)
17
+ Ellipsoid::lookup('wGS 84').should be(@wgs84)
18
+ end
19
+
20
+ it 'should lookup with symbol names' do
21
+ Ellipsoid::lookup(:wgs84).should be(@wgs84)
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,39 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ require 'yaml'
4
+
5
+ module GeoUtm
6
+ # http://rspec.info/
7
+ describe GeoUtm do
8
+ before :each do
9
+ @testdata = nil
10
+ File.open(File.join(File.dirname(__FILE__), 'testdata.yaml')) {|f| @testdata = YAML::load f }
11
+ end
12
+
13
+ it "should return an ellipsoid for every test sample" do
14
+ @testdata.each do |sample|
15
+ Ellipsoid::lookup(sample[:ellipsoid]).should be_a_kind_of(Ellipsoid)
16
+ end
17
+ end
18
+
19
+ it "should convert from lat/lon to UTM" do
20
+ @testdata.each do |sample|
21
+ latlon = LatLon.new sample[:latitude].to_f, sample[:longitude].to_f
22
+ utm = latlon.to_utm Ellipsoid::lookup(sample[:ellipsoid])
23
+ utm.n.should be_close(sample[:northing].to_f, 0.01)
24
+ utm.e.should be_close(sample[:easting].to_f, 0.01)
25
+ utm.zone.should == sample[:zone]
26
+ end
27
+ end
28
+
29
+ it "should convert from UTM to lat/lon" do
30
+ @testdata.each do |sample|
31
+ utm = UTM.new sample[:zone], sample[:easting].to_f, sample[:northing].to_f,
32
+ Ellipsoid::lookup(sample[:ellipsoid])
33
+ latlon = utm.to_lat_lon
34
+ latlon.lat.should be_close(sample[:latitude].to_f, 0.01)
35
+ latlon.lon.should be_close(sample[:longitude].to_f, 0.01)
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,17 @@
1
+ require File.dirname(__FILE__) + '/spec_helper.rb'
2
+
3
+ module GeoUtm
4
+ # http://rspec.info/
5
+ describe LatLon do
6
+ before :each do
7
+ # some random points
8
+ @p1 = LatLon.new -25.9668774017417, 176.847283481794
9
+ @p2 = LatLon.new 62.6643472980663, -18.1318011641218
10
+ end
11
+
12
+ it 'should format as string' do
13
+ @p1.to_s.should == '25.966877S 176.847283E'
14
+ @p2.to_s.should == '62.664347N 18.131801W'
15
+ end
16
+ end
17
+ end
data/spec/spec.opts ADDED
@@ -0,0 +1 @@
1
+ --colour
@@ -0,0 +1,10 @@
1
+ begin
2
+ require 'spec'
3
+ rescue LoadError
4
+ require 'rubygems'
5
+ gem 'rspec'
6
+ require 'spec'
7
+ end
8
+
9
+ $:.unshift(File.dirname(__FILE__) + '/../lib')
10
+ require 'geoutm'