server-side-google-maps 0.0.5 → 0.1.0

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/README.md CHANGED
@@ -11,25 +11,25 @@ To install:
11
11
 
12
12
  Then, to use within Ruby:
13
13
 
14
- directions = Directions.new('Montreal, QC', 'Ottawa, ON', :mode => :driving)
14
+ route = ServerSideGoogleMaps::Route.new(['Montreal, QC', 'Ottawa, ON'], :mode => :driving)
15
15
  # Origin and destination accept [lat,lon] coordinates as well as strings
16
16
  # :mode => :driving is the default. Others are :bicycling and :walking
17
17
 
18
- directions.status # 'OK'
19
- directions.origin_address # 'Montreal, QC, Canada'
20
- directions.origin_point # [ 45.5086700, -73.5536800 ]
21
- directions.destination_address # 'Ottawa, ON, Canada'
22
- directions.destination_point # [ 45.4119000, -75.6984600 ]
23
- directions.points # Array of [lat,lon] coordinates of route
24
- directions.distance # 199901 (metres)
25
-
26
- route = Route.new(['Montreal, QC', 'Ottawa, ON', 'Toronto, ON'], :mode => :bicycling)
27
- # All the same methods apply to route as to directions
18
+ route.status # 'OK'
19
+ route.origin_address # 'Montreal, QC, Canada'
20
+ route.origin_point # [ 45.5086700, -73.5536800 ]
21
+ route.destination_address # 'Ottawa, ON, Canada'
22
+ route.destination_point # [ 45.4119000, -75.6984600 ]
23
+ route.path.points # Array of Point coordinates of route
24
+ route.points[0].latitude # .latitude, .longitude, .distance_to_here
25
+ route.distance # 199901 (metres)
28
26
 
29
27
  # We can also find elevations along a path
30
- path = Path.new([ [ 45.5086700, -73.5536800 ], [ 45.4119000, -75.6984600 ] ]) # a straight line
31
- path.elevations(20) # Array of equidistant altitudes, in metres, along the path
32
- # Paths may only be up to around 230 points long, to comply with Google's URL length limit.
28
+ path = route.path
29
+ path.elevations(20) # Array of equidistant Points, each with an elevation
30
+ # Paths used for elevation may only be up to around 230 points long,
31
+ # to comply with Google's URL length limit. That's not hard to achieve:
32
+ simple_path = path.interpolate(230) # will create a new Path by interpolating
33
33
 
34
34
  One final `:mode` is `:direct`, which calculates `points` and estimates
35
35
  `distance` without querying Google. To ensure Google isn't queried, input
@@ -5,6 +5,7 @@ require 'server-side-google-maps/version'
5
5
  require 'server-side-google-maps/directions'
6
6
  require 'server-side-google-maps/geo_math'
7
7
  require 'server-side-google-maps/path'
8
+ require 'server-side-google-maps/point'
8
9
  require 'server-side-google-maps/route'
9
10
  require 'server-side-google-maps/server'
10
11
 
@@ -47,7 +47,7 @@ module ServerSideGoogleMaps
47
47
 
48
48
  other = Directions.new(origin, destination, params.merge(:mode => mode))
49
49
  if other.distance.to_f / distance < factor
50
- @points = other.points
50
+ @path = other.path
51
51
  @distance = other.distance
52
52
  end
53
53
  end
@@ -71,31 +71,31 @@ module ServerSideGoogleMaps
71
71
  end
72
72
 
73
73
  def origin_point
74
- @origin_point ||= origin_point_without_server || [ leg['start_location']['lat'], leg['start_location']['lng'] ]
74
+ @origin_point ||= origin_point_without_server || Point.new(leg['start_location']['lat'], leg['start_location']['lng'])
75
75
  end
76
76
 
77
77
  def destination_point
78
- @destination_point ||= destination_point_without_server || [ leg['end_location']['lat'], leg['end_location']['lng'] ]
78
+ @destination_point ||= destination_point_without_server || Point.new(leg['end_location']['lat'], leg['end_location']['lng'])
79
79
  end
80
80
 
81
81
  def status
82
82
  @data['status']
83
83
  end
84
84
 
85
- def points
86
- @points ||= calculate_points
87
- end
88
-
89
85
  def distance
90
86
  @distance ||= calculate_distance
91
87
  end
92
88
 
93
- def estimated_distance
94
- @estimated_distance ||= calculate_estimated_distance
89
+ def path
90
+ @path ||= Path.new(points)
95
91
  end
96
92
 
97
93
  private
98
94
 
95
+ def points # DEPRECATED
96
+ @points ||= calculate_points
97
+ end
98
+
99
99
  def origin_point_without_server
100
100
  calculate_point_without_server_or_nil(origin_input)
101
101
  end
@@ -107,7 +107,7 @@ module ServerSideGoogleMaps
107
107
  def calculate_point_without_server_or_nil(input)
108
108
  return input if Array === input
109
109
  m = LATLNG_STRING_REGEXP.match(input)
110
- return [ m[1].to_f, m[3].to_f ] if m
110
+ return Point.new(m[1].to_f, m[3].to_f) if m
111
111
  end
112
112
 
113
113
  def route
@@ -124,34 +124,25 @@ module ServerSideGoogleMaps
124
124
 
125
125
  def calculate_points_and_levels
126
126
  polyline = route['overview_polyline']
127
- return [ origin_point + [0], destination_point + [0]] unless polyline && polyline['points'] && polyline['levels']
127
+ return [ [origin_point.latitude, origin_point.longitude, 0], [destination_point.latitude, destination_point.longitude, 0]] unless polyline && polyline['points'] && polyline['levels']
128
128
  ::GoogleMapsPolyline.decode_polyline(polyline['points'], polyline['levels'])
129
129
  end
130
130
 
131
131
  def calculate_points
132
132
  return [ origin_point, destination_point ] if @direct
133
- points = points_and_levels.map { |lat,lng,level| [lat,lng] }
133
+ points = points_and_levels.map { |lat,lng,level| Point.new(lat, lng) }
134
134
  points
135
135
  end
136
136
 
137
137
  def calculate_distance
138
- return estimated_distance if @direct
138
+ if @direct
139
+ path.calculate_distances unless path.points[0].distance_along_path
140
+ return path.points[-1].distance_along_path
141
+ end
139
142
  if !leg['distance']
140
143
  return leg['steps'].collect{|s| s['distance']}.collect{|d| d ? d['value'].to_i : 0}.inject(0){|s,v| s += v}
141
144
  end
142
145
  leg['distance']['value']
143
146
  end
144
-
145
- def calculate_estimated_distance
146
- d = 0
147
- last_point = points[0]
148
-
149
- points[1..-1].each do |point|
150
- d += GeoMath.latlng_distance(last_point, point)
151
- last_point = point
152
- end
153
-
154
- d
155
- end
156
147
  end
157
148
  end
@@ -1,5 +1,7 @@
1
1
  module ServerSideGoogleMaps
2
2
  class Path
3
+ attr_reader(:points)
4
+
3
5
  def self.get_elevations(params)
4
6
  server = Server.new
5
7
  server.get('/maps/api/elevation', {:sensor => false}.merge(params))
@@ -10,15 +12,82 @@ module ServerSideGoogleMaps
10
12
  raise ArgumentError.new('path must have one or more points') unless points.length > 0
11
13
  i = 0
12
14
  @points = points.collect do |pt|
13
- raise ArgumentError.new("path element #{i} must be a [latitude, longitude] Array") unless pt.length == 2
14
- pt.dup
15
+ raise ArgumentError.new("path element #{i} must have .latitude and .longitude") unless pt.respond_to?(:latitude)
16
+ pt
15
17
  end
16
18
  end
17
19
 
18
- # Returns an Array of n equidistant altitudes (in metres) along this path
20
+ # Returns a new Path with n equidistant Points along this Path, complete with .elevation
19
21
  def elevations(n)
20
22
  results = self.class.get_elevations(:path => "enc:#{encoded_path}", :samples => n)
21
- results['results'].collect { |r| r['elevation'].to_f }
23
+ points = results['results'].collect do |r|
24
+ Point.new(
25
+ r['location']['lat'].to_f,
26
+ r['location']['lng'].to_f,
27
+ :elevation => r['elevation'].to_f
28
+ )
29
+ end
30
+ Path.new(points)
31
+ end
32
+
33
+ # Sets .distance on every Point in the Path
34
+ #
35
+ # Yes, this is a hack: it assumes all the Points will only belong to this Path.
36
+ # It's here because it's convenient.
37
+ def calculate_distances
38
+ total_distance = 0
39
+ last_point = nil
40
+ points.each do |point|
41
+ if last_point
42
+ distance_piece = last_point.distance(point)
43
+ total_distance += distance_piece
44
+ end
45
+ point.distance_along_path = total_distance
46
+ last_point = point
47
+ end
48
+ end
49
+
50
+ # Returns a Path that approximates this one, with n points
51
+ def interpolate(n)
52
+ calculate_distances unless points[0].distance_along_path
53
+
54
+ total_distance = points[-1].distance_along_path - points[0].distance_along_path
55
+ distance_step = 1.0 * total_distance / (n - 1)
56
+
57
+ ret = []
58
+ ret << Point.new(
59
+ points[0].latitude,
60
+ points[0].longitude,
61
+ :distance_along_path => points[0].distance_along_path
62
+ )
63
+
64
+ j = 0
65
+ current_distance = points[0].distance_along_path
66
+ (1...(n - 1)).each do |i|
67
+ current_distance += distance_step if i > 0
68
+ while j < (points.length - 2) && points[j + 1].distance_along_path < current_distance #&& points[j].distance_along_path == points[j + 1].distance_along_path
69
+ j += 1
70
+ end
71
+
72
+ point_before = points[j]
73
+ point_after = points[j + 1]
74
+ point_segment_length = point_after.distance_along_path - point_before.distance_along_path
75
+
76
+ fraction_after = (1.0 * current_distance - point_before.distance_along_path) / point_segment_length
77
+ fraction_before = 1.0 - fraction_after
78
+
79
+ ret << Point.new(
80
+ fraction_before * point_before.latitude + fraction_after * point_after.latitude,
81
+ fraction_before * point_before.longitude + fraction_after * point_after.longitude,
82
+ :distance_along_path => current_distance.round
83
+ )
84
+ end
85
+
86
+ ret << Point.new(
87
+ points[-1].latitude,
88
+ points[-1].longitude,
89
+ :distance_along_path => points[-1].distance_along_path
90
+ )
22
91
  end
23
92
 
24
93
  private
@@ -28,7 +97,7 @@ module ServerSideGoogleMaps
28
97
  end
29
98
 
30
99
  def points_1e5
31
- @points.map { |latitude, longitude| [ (latitude * 1e5).to_i, (longitude * 1e5).to_i ] }
100
+ @points.map { |p| [ (p.latitude * 1e5).to_i, (p.longitude * 1e5).to_i ] }
32
101
  end
33
102
  end
34
103
  end
@@ -0,0 +1,49 @@
1
+ module ServerSideGoogleMaps
2
+ class Point
3
+ RADIUS_OF_EARTH = 6367000 # metres
4
+ DEGREES_TO_RADIANS = Math::PI / 180
5
+
6
+ attr_reader(:latitude, :longitude, :object, :elevation)
7
+ attr_accessor(:distance_along_path)
8
+
9
+ def initialize(latitude, longitude, options = {})
10
+ @latitude = latitude
11
+ @longitude = longitude
12
+ @object = options[:object] if options[:object]
13
+ @distance_along_path = options[:distance_along_path] if options[:distance_along_path]
14
+ @elevation = options[:elevation] if options[:elevation]
15
+ end
16
+
17
+ def ==(other)
18
+ latitude == other.latitude && longitude == other.longitude && object == other.object
19
+ end
20
+
21
+ # Calculates the distance to another point, in metres
22
+ #
23
+ # The method assumes the Earth is a sphere.
24
+ def distance(other)
25
+ lat1 = latitude * DEGREES_TO_RADIANS
26
+ lat2 = other.latitude * DEGREES_TO_RADIANS
27
+ dlat = lat2 - lat1
28
+ dlon = (longitude - other.longitude) * DEGREES_TO_RADIANS
29
+
30
+ # Optimize a tad. This method is slow.
31
+ sin_dlat = Math.sin(dlat / 2)
32
+ sin_dlon = Math.sin(dlon / 2)
33
+
34
+ a = sin_dlat * sin_dlat + Math.cos(lat1) * Math.cos(lat2) * sin_dlon * sin_dlon
35
+
36
+ sqrt_a = Math.sqrt(a)
37
+
38
+ c = 2 * Math.asin(1.0 < sqrt_a ? 1.0 : sqrt_a)
39
+
40
+ (RADIUS_OF_EARTH * c).to_i
41
+ end
42
+
43
+ def latlng_distance_squared(other)
44
+ latitude_difference = latitude - other.latitude
45
+ longitude_difference = longitude - other.longitude
46
+ latitude_difference * latitude_difference + longitude_difference * longitude_difference
47
+ end
48
+ end
49
+ end
@@ -32,22 +32,22 @@ module ServerSideGoogleMaps
32
32
  @directionses.last.destination_point
33
33
  end
34
34
 
35
- def points
36
- @points ||= calculate_points
35
+ def path
36
+ Path.new(points)
37
37
  end
38
38
 
39
39
  def distance
40
40
  @distance ||= @directionses.map{|d| d.distance}.inject(:+)
41
41
  end
42
42
 
43
- def estimated_distance
44
- @estimated_distance ||= @directionses.map{|d| d.estimated_distance}.inject(:+)
45
- end
46
-
47
43
  private
48
44
 
45
+ def points # DEPRECATED
46
+ @points ||= calculate_points
47
+ end
48
+
49
49
  def calculate_points
50
- pointses = @directionses.map { |d| d.points }
50
+ pointses = @directionses.map { |d| d.path.points }
51
51
 
52
52
  first = pointses.shift
53
53
 
@@ -1,3 +1,3 @@
1
1
  module ServerSideGoogleMaps
2
- VERSION = "0.0.5"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -70,8 +70,8 @@ module ServerSideGoogleMaps
70
70
 
71
71
  it('should have origin_point and destination_point') do
72
72
  directions = Directions.new('Montreal,QC', 'Ottawa,ON')
73
- directions.origin_point.should == [ 45.5086700, -73.5536800 ]
74
- directions.destination_point.should == [ 45.4119000, -75.6984600 ]
73
+ directions.origin_point.should == Point.new(45.5086700, -73.5536800)
74
+ directions.destination_point.should == Point.new(45.4119000, -75.6984600)
75
75
  end
76
76
 
77
77
  it('should have an "OK" status') do
@@ -81,11 +81,11 @@ module ServerSideGoogleMaps
81
81
 
82
82
  it('should have the proper points') do
83
83
  directions = Directions.new('Montreal,QC', 'Ottawa,ON')
84
- points = directions.points
84
+ points = directions.path.points
85
85
  points.length.should == 138
86
- points[0].should == [45.50867, -73.55368]
87
- points[1].should == [45.50623, -73.55569]
88
- points[-1].should == [45.4119, -75.69846]
86
+ points[0].should == Point.new(45.50867, -73.55368)
87
+ points[1].should == Point.new(45.50623, -73.55569)
88
+ points[-1].should == Point.new(45.4119, -75.69846)
89
89
  end
90
90
 
91
91
  it('should have the proper distance') do
@@ -94,27 +94,21 @@ module ServerSideGoogleMaps
94
94
  distance.should == 199901
95
95
  end
96
96
 
97
- it('should supply an estimated_distance') do
98
- directions = Directions.new('Montreal,QC', 'Ottawa,ON')
99
- distance = directions.estimated_distance
100
- distance.should == 199127
101
- end
102
-
103
97
  it('should suggest a straight line, with :direct') do
104
98
  directions = Directions.new('Montreal,QC', 'Ottawa,ON', :mode => :direct)
105
- directions.points.should == [[45.50867, -73.55368], [45.4119, -75.69846]]
99
+ directions.path.points.should == [Point.new(45.50867, -73.55368), Point.new(45.4119, -75.69846)]
106
100
  directions.distance.should == 167512
107
101
  end
108
102
 
109
103
  it('should suggest normal route if :find_shortcuts shortcuts are not short enough') do
110
104
  directions = Directions.new('Montreal,QC', 'Ottawa,ON', :find_shortcuts => [{ :factor => 0.5, :mode => :direct }])
111
- directions.points.length.should > 2
105
+ directions.path.points.length.should > 2
112
106
  directions.distance.should == 199901
113
107
  end
114
108
 
115
109
  it('should suggest a shortcut if :find_shortcuts finds a shortcut') do
116
110
  directions = Directions.new('Montreal,QC', 'Ottawa,ON', :find_shortcuts => [{ :factor => 0.95, :mode => :direct }])
117
- directions.points.length.should == 2
111
+ directions.path.points.length.should == 2
118
112
  directions.distance.should == 167512
119
113
  end
120
114
 
@@ -157,7 +151,7 @@ module ServerSideGoogleMaps
157
151
 
158
152
  it('should provide the start-point and end-point instead') do
159
153
  directions = Directions.new('Montreal,QC', 'Ottawa,ON')
160
- directions.points.should == [[45.50867, -73.55368], [45.4119, -75.69846]]
154
+ directions.path.points.should == [Point.new(45.50867, -73.55368), Point.new(45.4119, -75.69846)]
161
155
  end
162
156
  end
163
157
  end
data/spec/path_spec.rb CHANGED
@@ -15,7 +15,7 @@ module ServerSideGoogleMaps
15
15
  end
16
16
 
17
17
  it('should allow a 1-point path') do
18
- pt = [ 45.5086700, -73.5536800 ]
18
+ pt = Point.new(45.5086700, -73.5536800)
19
19
  Path.new([pt])
20
20
  end
21
21
  end
@@ -37,22 +37,74 @@ module ServerSideGoogleMaps
37
37
  describe('#elevations') do
38
38
  it('should pass an encoded :path and :samples to #get_elevations') do
39
39
  Path.should_receive(:get_elevations).with(:path => 'enc:elwtGn}|_M~piJnlqb@', :samples => 20)
40
- pt1 = [ 45.50867, -73.55368 ]
41
- pt2 = [ 43.65235, -79.38240 ]
40
+ pt1 = Point.new(45.50867, -73.55368)
41
+ pt2 = Point.new(43.65235, -79.38240)
42
42
  path = Path.new([pt1, pt2])
43
43
  path.elevations(20)
44
44
  end
45
45
 
46
46
  it('should return the proper elevations') do
47
- pt1 = [ 45.50867, -73.55368 ]
48
- pt2 = [ 43.65235, -79.38240 ]
47
+ pt1 = Point.new(45.50867, -73.55368)
48
+ pt2 = Point.new(43.65235, -79.38240)
49
49
  path = Path.new([pt1, pt2])
50
50
  elevations = path.elevations(20)
51
- elevations.length.should == 20 # the 20 is from the stub file, not the above argument
52
- elevations[0].should == 15.3455887
53
- elevations[19].should == 89.6621323
51
+ elevations.points.length.should == 20 # the 20 is from the stub file, not the above argument
52
+ elevations.points[0].elevation.should == 15.3455887
53
+ elevations.points[0].latitude.should == 45.50867
54
+ elevations.points[0].longitude.should == -73.55368
55
+ elevations.points[19].elevation.should == 89.6621323
54
56
  end
55
57
  end
56
58
  end
59
+
60
+ describe('#calculate_distances') do
61
+ it('should put 0 on a 1-element Path') do
62
+ p1 = Point.new(1.0, 2.0)
63
+ path = Path.new([p1])
64
+ path.calculate_distances
65
+ path.points[0].distance_along_path.should == 0
66
+ end
67
+
68
+ it('should calculate the distance for each element') do
69
+ p1 = Point.new(1.0, 2.0)
70
+ p2 = Point.new(4.0, 1.0)
71
+ p3 = Point.new(3.0, 8.0)
72
+ path = Path.new([p1, p2, p3])
73
+ path.calculate_distances
74
+ path.points[0].distance_along_path.should == 0
75
+ path.points[1].distance_along_path.should == 351371
76
+ path.points[2].distance_along_path.should == 1135696
77
+ end
78
+ end
79
+
80
+ describe('#interpolate') do
81
+ it('should return a new, interpolated Path with more than the original number of points') do
82
+ p1 = Point.new(1.0, 2.0)
83
+ p2 = Point.new(7.0, 2.0)
84
+ p3 = Point.new(7.0, 1.0)
85
+ path = Path.new([p1, p2, p3])
86
+ interpolated = path.interpolate(8)
87
+ interpolated.length.should == 8
88
+ interpolated[0].should == p1
89
+ interpolated[6].latitude.to_s.should == '6.9936056564358' # too many decimals...
90
+ interpolated[6].longitude.should == 2.0
91
+ interpolated[6].distance_along_path.should == 666039
92
+ interpolated[7].should == p3
93
+ end
94
+
95
+ it('should work okay when duplicate Points are on the Path') do
96
+ p1 = Point.new(1.0, 2.0)
97
+ p2 = Point.new(7.0, 2.0)
98
+ p2_2 = Point.new(7.0, 2.0)
99
+ p3 = Point.new(7.0, 1.0)
100
+ path = Path.new([p1, p2, p2_2, p3])
101
+ interpolated = path.interpolate(8)
102
+ interpolated[0].should == p1
103
+ interpolated[6].latitude.to_s.should == '6.9936056564358' # too many decimals...
104
+ interpolated[6].longitude.should == 2.0
105
+ interpolated[6].distance_along_path.should == 666039
106
+ interpolated[7].should == p3
107
+ end
108
+ end
57
109
  end
58
110
  end
@@ -0,0 +1,50 @@
1
+ require 'spec'
2
+
3
+ module ServerSideGoogleMaps
4
+ describe(Point) do
5
+ describe('#initialize') do
6
+ it('should set latitude and longitude') do
7
+ point = Point.new(1.2, 3.4)
8
+ point.latitude.should == 1.2
9
+ point.longitude.should == 3.4
10
+ end
11
+
12
+ it('should work without an "object" option') do
13
+ point = Point.new(1.2, 3.4)
14
+ point.object.should == nil
15
+ end
16
+
17
+ it('should work with a "distance_along_path" option') do
18
+ point = Point.new(1.2, 3.4, :distance_along_path => 341)
19
+ point.distance_along_path.should == 341
20
+ end
21
+
22
+ it('should work with a "elevation" option') do
23
+ point = Point.new(1.2, 3.4, :elevation => 341)
24
+ point.elevation.should == 341
25
+ end
26
+
27
+ it('should allow an "object" option') do
28
+ object = [1, 2, 3]
29
+ point = Point.new(1.2, 3.4, :object => object)
30
+ point.object.should == object
31
+ end
32
+ end
33
+
34
+ describe('#latlng_distance_squared') do
35
+ it('should calculate the lat/lng distance squared') do
36
+ point1 = Point.new(1.0, 4.0)
37
+ point2 = Point.new(2.0, 6.0)
38
+ point1.latlng_distance_squared(point2).should == 5.0
39
+ end
40
+ end
41
+
42
+ describe('#distance') do
43
+ it('should calculate the distance') do
44
+ point1 = Point.new(1.0, 4.0)
45
+ point2 = Point.new(2.0, 6.0)
46
+ point1.distance(point2).should == 248412
47
+ end
48
+ end
49
+ end
50
+ end
data/spec/route_spec.rb CHANGED
@@ -58,18 +58,18 @@ module ServerSideGoogleMaps
58
58
 
59
59
  it('should return appropriate origin_point and destination_point') do
60
60
  route = Route.new(['Montreal,QC', 'Ottawa,ON', 'Toronto,ON'])
61
- route.origin_point.should == [ 45.5086700, -73.5536800 ]
62
- route.destination_point.should == [ 43.65235, -79.3824 ]
61
+ route.origin_point.should == Point.new(45.5086700, -73.5536800)
62
+ route.destination_point.should == Point.new(43.65235, -79.3824)
63
63
  end
64
64
 
65
65
  it('should concatenate the points from component directions') do
66
66
  route = Route.new(['Montreal,QC', 'Ottawa,ON', 'Toronto,ON'])
67
- points = route.points
67
+ points = route.path.points
68
68
  points.length.should == 352
69
- points[0].should == [45.50867, -73.55368]
70
- points[137].should == [45.4119, -75.69846]
71
- points[138].should == [45.40768, -75.69567]
72
- points[351].should == [ 43.65235, -79.3824 ]
69
+ points[0].should == Point.new(45.50867, -73.55368)
70
+ points[137].should == Point.new(45.4119, -75.69846)
71
+ points[138].should == Point.new(45.40768, -75.69567)
72
+ points[351].should == Point.new(43.65235, -79.3824)
73
73
  end
74
74
 
75
75
  it('should have the proper distance') do
@@ -78,12 +78,6 @@ module ServerSideGoogleMaps
78
78
  distance.should == 649742
79
79
  end
80
80
 
81
- it('should have the proper estimated_distance') do
82
- route = Route.new(['Montreal,QC', 'Ottawa,ON', 'Toronto,ON'])
83
- distance = route.estimated_distance
84
- distance.should == 647730
85
- end
86
-
87
81
  it('should not alter params') do
88
82
  original_params = {
89
83
  :mode => :driving,
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: server-side-google-maps
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
5
- prerelease: false
4
+ hash: 27
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
+ - 1
8
9
  - 0
9
- - 5
10
- version: 0.0.5
10
+ version: 0.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Adam Hooper
@@ -15,8 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-05-17 00:00:00 -05:00
19
- default_executable:
18
+ date: 2011-06-10 00:00:00 Z
20
19
  dependencies:
21
20
  - !ruby/object:Gem::Dependency
22
21
  name: httparty
@@ -77,6 +76,7 @@ files:
77
76
  - lib/server-side-google-maps/directions.rb
78
77
  - lib/server-side-google-maps/geo_math.rb
79
78
  - lib/server-side-google-maps/path.rb
79
+ - lib/server-side-google-maps/point.rb
80
80
  - lib/server-side-google-maps/route.rb
81
81
  - lib/server-side-google-maps/server.rb
82
82
  - lib/server-side-google-maps/version.rb
@@ -89,9 +89,9 @@ files:
89
89
  - spec/files/directions-Ottawa,ON-to-Toronto,ON.txt
90
90
  - spec/files/path1-get_elevations-result.txt
91
91
  - spec/path_spec.rb
92
+ - spec/point_spec.rb
92
93
  - spec/route_spec.rb
93
94
  - spec/spec.rb
94
- has_rdoc: true
95
95
  homepage: http://github.com/adamh/server-side-google-maps
96
96
  licenses: []
97
97
 
@@ -121,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  requirements: []
122
122
 
123
123
  rubyforge_project: server-side-google-maps
124
- rubygems_version: 1.3.7
124
+ rubygems_version: 1.7.2
125
125
  signing_key:
126
126
  specification_version: 3
127
127
  summary: Performs calculations with Google Maps