ruby-on-railsgeokit

Search by location using an array with geokit gem


I need to search on two or more locations

model = Model.in_range("0".."5",:origin => [LatLng, LatLng, LatLng, LatLng)

is posible?


Solution

  • You can chain multiple calls like:

    model = Model.in_range("0".."5",:origin => [Lat1, Lng1]).in_range("0".."5",:origin => [Lat2, Lng2])
    

    For deep reference, check the method at https://github.com/geokit/geokit-rails/blob/3a7b4e1083dd06d486307ebf71c36608186c8d73/lib/geokit-rails/acts_as_mappable.rb#L134