Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Ruby
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
lib/mini_gis
README
init.rb

README

class Foo < ActiveRecord::Base
  # With column names "lat" and "lng", and
  # virtual distance column name "distance"
  acts_as_location
end

class Bar < ActiveRecord::Base
  acts_as_location :latitude, :longitude, :dist
end

# Operations:

Foo.origin(lat, lng).where('name = ?', 'John').limit(2) # ...
Foo.where('name = ?', 'John').origin(lat, lng).limit(2) # ...
Foo.origin(lat, lng, :within => 3, :order => :desc).limit(2) # ...

# Geokit methods work:

Foo.find(1).distance_from Foo.find(2)
Something went wrong with that request. Please try again.