Browse Source

Converted radius from km to m

master
Adrian Short 12 years ago
parent
commit
b9b0e0bbb0
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      app/models/post.rb

+ 3
- 3
app/models/post.rb View File

@@ -14,13 +14,13 @@ class Post


belongs_to :feed belongs_to :feed
EARTH_RADIUS_KM = 6378.0 EARTH_RADIUS_M = 6378000
def self.near(lat, lng, radius_km) def self.near(lat, lng, radius_m)
all( all(
:loc => { :loc => {
'$nearSphere' => [ lng, lat ], '$nearSphere' => [ lng, lat ],
'$maxDistance' => radius_km / EARTH_RADIUS_KM '$maxDistance' => radius_m / EARTH_RADIUS_M
}) })
end end
end end

||||||
x
 
000:0
Loading…
Cancel
Save