Use QuadTiling in GPS point queries.

This commit is contained in:
Tom Hughes 2007-09-12 12:14:45 +00:00
parent 1fcd5f5593
commit 0423884184
3 changed files with 14 additions and 16 deletions

View file

@ -1,11 +1,17 @@
class Tracepoint < ActiveRecord::Base
set_table_name 'gps_points'
set_table_name 'gps_points'
# validates_numericality_of :latitude
# validates_numericality_of :longitude
belongs_to :user
belongs_to :trace, :foreign_key => 'gpx_id'
def self.find_by_area(minlat, minlon, maxlat, maxlon, options)
self.with_scope(:find => {:conditions => OSM.sql_for_area(minlat, minlon, maxlat, maxlon)}) do
return self.find(:all, options)
end
end
def lat=(l)
self.latitude = l * 1000000
@ -29,5 +35,4 @@ set_table_name 'gps_points'
el1['lon'] = self.lon.to_s
return el1
end
end