开发者

get nearby locations of certain location with mongoid or rubygeocode

I have something like

@office = Office.first
@offices = Office.where(:status => "active")

How do I get offices near @office from above variables, i.e I want something like

@offices.near(@office.latitude, @office.longitude) or
Office.near([@office.latitude, @office.longitude]).where(:status=>"active")

I can get this with @office.nearbys( with rubygeocoder) but that is not an option for me rig开发者_如何学Goht now, I need to utilize a near method on the collection to get offices near a given office.

Or is there other gems I can use to do this if not possible with rubygeocoder or mongoid ? Thanks .


I tried to find other solution but at last I am going with

@offices = @office.nearbys

At it does the work evenif not the way I wanted it to .

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜