For an example, I have a model like this
class Place < ActiveRecord::Base
# has a "latitude" & "longitude" field
# notice it has "max_distance" field (meter), will be different on each record
end
How can I achieve a query that given a coordinate point, will get all places within in range between distance coordinate point and max_distance field.
lat = 37.792
lng = -122.393
Place.query_in_range_by_point([lat, lng])
# will get nearest places within range "max_distance" field
I have been looking in Geocoder & Geo-Kit gem documentation, but not found any functionality like that.
If gem above not supported the functionality, can anyone suggest another method that can solve the problem?
Thanks