1 class Tracepoint < ActiveRecord::Base
2 set_table_name 'gps_points'
4 # validates_numericality_of :latitude
5 # validates_numericality_of :longitude
8 belongs_to :trace, :foreign_key => 'gpx_id'
10 def self.find_by_area(minlat, minlon, maxlat, maxlon, options)
11 self.with_scope(:find => {:conditions => OSM.sql_for_area(minlat, minlon, maxlat, maxlon)}) do
12 return self.find(:all, options)
17 self.latitude = l * 1000000
21 self.longitude = l * 1000000
25 return self.latitude.to_f / 1000000
29 return self.longitude.to_f / 1000000
33 el1 = XML::Node.new 'trkpt'
34 el1['lat'] = self.lat.to_s
35 el1['lon'] = self.lon.to_s