vincenty 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +27 -3
- data/README.txt +1 -1
- data/Rakefile +7 -6
- data/lib/latitude.rb +8 -8
- data/lib/longitude.rb +2 -2
- data/lib/vincenty.rb +6 -1
- data/test/ts_all.rb +4 -0
- data/test/ts_track_and_distance.rb +1 -1
- data/test/ts_vincenty.rb +1 -1
- metadata +6 -14
data/History.txt
CHANGED
@@ -1,6 +1,30 @@
|
|
1
|
-
|
1
|
+
commit e8d8d9bce43f58b0bd487e48308f170ca48c380d
|
2
|
+
Author: rbur004 <rob@burrowes.org>
|
3
|
+
Date: Thu Dec 31 22:50:16 2009 +1300
|
2
4
|
|
3
|
-
|
5
|
+
Hoe gem builder version changed, requiring changes in Hoe calls
|
6
|
+
|
7
|
+
Added index.html to redirect fetches to base URL to /vincenty/ as this is where
|
8
|
+
the rdoc is being installed by Hoe.
|
4
9
|
|
5
|
-
|
10
|
+
commit 11a54e72e1681f8ec9430476a0c790be8162e125
|
11
|
+
Author: rbur004 <rob@burrowes.org>
|
12
|
+
Date: Thu Dec 31 20:06:29 2009 +1300
|
6
13
|
|
14
|
+
Added version method to Vincenty to verify which gem version we are actually using.
|
15
|
+
|
16
|
+
Changed : to ; in case statements to be ruby 1.9 compatible.
|
17
|
+
|
18
|
+
commit cee92bca2c1da98980579d518951729fa17db8b2
|
19
|
+
Author: rbur004 <rob@burrowes.org>
|
20
|
+
Date: Fri Mar 6 04:36:51 2009 +1300
|
21
|
+
|
22
|
+
Minor fix to require list in test/ts_all and added two tests.
|
23
|
+
|
24
|
+
Tidy up to work with "hoe" for gem creation and uploading to Rubyforge.
|
25
|
+
|
26
|
+
commit e5813363fc192b071ccfb54a799ecdca38abc887
|
27
|
+
Author: rbur004 <rob@burrowes.org>
|
28
|
+
Date: Tue Mar 3 19:17:36 2009 +1300
|
29
|
+
|
30
|
+
Initial commit of version 1.0.1.
|
data/README.txt
CHANGED
@@ -57,7 +57,7 @@
|
|
57
57
|
|
58
58
|
Code unique to this implementation of Vincentys algrithm is distributed under the Ruby License.
|
59
59
|
|
60
|
-
Copyright (c) 2009
|
60
|
+
Copyright (c) 2009
|
61
61
|
|
62
62
|
1. You may make and give away verbatim copies of the source form of the
|
63
63
|
software without restriction, provided that you duplicate all of the
|
data/Rakefile
CHANGED
@@ -1,16 +1,17 @@
|
|
1
|
+
#!/usr/bin/ruby
|
1
2
|
# -*- ruby -*-
|
2
3
|
|
3
|
-
require 'rubygems'
|
4
|
+
#require 'rubygems'
|
4
5
|
require 'hoe'
|
5
|
-
require 'lib/vincenty.rb'
|
6
|
+
#require 'lib/vincenty.rb'
|
6
7
|
|
7
8
|
|
8
|
-
Hoe.
|
9
|
-
|
10
|
-
|
9
|
+
Hoe.spec 'vincenty' do
|
10
|
+
self.rubyforge_name = "vincenty"
|
11
|
+
developer( "Rob Burrowes","rob@burrowes.org")
|
11
12
|
#s.url = "http://rubyforge.org/projects/vincenty/"
|
12
13
|
#s.summary = "Vincenty Algorithm for Distance, Bearing between Map Coordinates."
|
13
14
|
#s.description = s.paragraphs_of('README.txt', 1..4).join("\n\n")
|
14
|
-
|
15
|
+
remote_rdoc_dir = '' # Release to root
|
15
16
|
end
|
16
17
|
|
data/lib/latitude.rb
CHANGED
@@ -9,10 +9,10 @@ class Latitude < Angle
|
|
9
9
|
#longitude's are -180 to 180 for west to east
|
10
10
|
degrees = super
|
11
11
|
case
|
12
|
-
when degrees > 270
|
13
|
-
when degrees > 180
|
14
|
-
when degrees > 90
|
15
|
-
when degrees < -90
|
12
|
+
when degrees > 270 ; -(360 - degrees)
|
13
|
+
when degrees > 180 ; 180 - degrees
|
14
|
+
when degrees > 90 ; 180 - degrees
|
15
|
+
when degrees < -90 ; 180 - degrees
|
16
16
|
else degrees
|
17
17
|
end
|
18
18
|
end
|
@@ -22,10 +22,10 @@ class Latitude < Angle
|
|
22
22
|
def to_radians
|
23
23
|
#longitude's are -180 to 180 for west to east
|
24
24
|
case
|
25
|
-
when @value > 3*Math::PI/2
|
26
|
-
when @value > Math::PI
|
27
|
-
when @value > Math::PI/2
|
28
|
-
when @value < -Math::PI/2
|
25
|
+
when @value > 3*Math::PI/2 ; @value - Math::PI * 2
|
26
|
+
when @value > Math::PI ; Math::PI - @value
|
27
|
+
when @value > Math::PI/2 ; Math::PI - @value
|
28
|
+
when @value < -Math::PI/2 ; -Math::PI - @value
|
29
29
|
else @value
|
30
30
|
end
|
31
31
|
end
|
data/lib/longitude.rb
CHANGED
@@ -8,7 +8,7 @@ class Longitude < Angle
|
|
8
8
|
def to_degrees
|
9
9
|
degrees = super
|
10
10
|
case
|
11
|
-
when degrees > 180
|
11
|
+
when degrees > 180 ; degrees - 360
|
12
12
|
else degrees
|
13
13
|
end
|
14
14
|
end
|
@@ -17,7 +17,7 @@ class Longitude < Angle
|
|
17
17
|
#Returns: angle as degrees in range -2PI and 2PI
|
18
18
|
def to_radians
|
19
19
|
case
|
20
|
-
when @value > Math::PI
|
20
|
+
when @value > Math::PI ; @value - 2 * Math::PI
|
21
21
|
else @value
|
22
22
|
end
|
23
23
|
end
|
data/lib/vincenty.rb
CHANGED
@@ -12,7 +12,12 @@ require 'track_and_distance.rb'
|
|
12
12
|
require 'coordinate.rb'
|
13
13
|
|
14
14
|
class Vincenty < Coordinate
|
15
|
-
VERSION = '1.0.
|
15
|
+
VERSION = '1.0.3'
|
16
|
+
|
17
|
+
def version
|
18
|
+
VERSION
|
19
|
+
end
|
20
|
+
|
16
21
|
#Great Circle formulae http://en.wikipedia.org/wiki/Great-circle_distance
|
17
22
|
#Reference calculation for testing, assumes the earth is a sphere, which it isn't.
|
18
23
|
#This gives us an approximation to verify Vincenty algorithm.
|
data/test/ts_all.rb
CHANGED
data/test/ts_vincenty.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vincenty
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rob Burrowes
|
@@ -9,19 +9,9 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-12-31 00:00:00 +13:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
|
-
- !ruby/object:Gem::Dependency
|
16
|
-
name: hoe
|
17
|
-
type: :development
|
18
|
-
version_requirement:
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 1.9.0
|
24
|
-
version:
|
25
15
|
description: "* Vincenty wrote an algorithm for calculating the bearing and distance between two coordinates on the earth and an algorithm for finding a second coordinate, given a starting coordinate, bearing and destination. The algorithms model the earth as an ellipsoid, using the WGS-84 model. This is the common GPS model for mapping to latitudes and longitudes. This is a Ruby implementation of Vincenty's algorithms, and the Vincenty class includes two methods for modeling the earth as a sphere. These were added as a reference for testing the Vincenty algorithm, but could be used on their own. The package also makes use of several other classes that may be useful in their own Right. These include class Angle, class Latitude (subclass of Angle), class Longitude (subclass of Angle), class TrackAndBearing and class coordinate (which class Vincenty is a subclass) Angle requires extensions to Numeric and String to provide to_radians (to_r) and to_degrees (to_d). String also includes a to_decimal_degrees(), which converts most string forms of Latitude and Longitude to decimal form. These extensions are included in the package in core_extensions.rb. Float has also been extended to change round to have an optional argument specifying the number of decimal places to round to. This is fully compatible with the Float.round, as the default is to round to 0 decimal places. * The Vincenty code is based on the wikipedia presentation of the Vincenty algorithm http://en.wikipedia.org/wiki/Vincenty%27s_formulae . * The algorithm was modified to include changes I found at http://www.movable-type.co.uk/scripts/latlong-vincenty-direct.html. * I also altered the formulae to correctly return the bearing for angles greater than 180. * Vincenty's original publication ** T Vincenty, \"Direct and Inverse Solutions of Geodesics on the Ellipsoid with application of nested equations\", Survey Review, vol XXII no 176, 1975 http://www.ngs.noaa.gov/PUBS_LIB/inverse.pdf"
|
26
16
|
email:
|
27
17
|
- rob@burrowes.org
|
@@ -53,7 +43,9 @@ files:
|
|
53
43
|
- test/ts_coordinate.rb
|
54
44
|
- test/ts_track_and_distance.rb
|
55
45
|
has_rdoc: true
|
56
|
-
homepage:
|
46
|
+
homepage: http://rubyforge.org/projects/vincenty/
|
47
|
+
licenses: []
|
48
|
+
|
57
49
|
post_install_message:
|
58
50
|
rdoc_options:
|
59
51
|
- --main
|
@@ -75,7 +67,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
67
|
requirements: []
|
76
68
|
|
77
69
|
rubyforge_project: vincenty
|
78
|
-
rubygems_version: 1.3.
|
70
|
+
rubygems_version: 1.3.5
|
79
71
|
signing_key:
|
80
72
|
specification_version: 2
|
81
73
|
summary: "* Vincenty wrote an algorithm for calculating the bearing and distance between two coordinates on the earth and an algorithm for finding a second coordinate, given a starting coordinate, bearing and destination"
|