2 # This scaling factor is used to convert between the float lat/lon that is
3 # returned by the API, and the integer lat/lon equivalent that is stored in
7 def self.included(base)
8 base.scope :bbox, ->(bbox) { base.where(OSM.sql_for_area(bbox)) }
9 base.before_save :update_tile
12 # Is this node within -90 >= latitude >= 90 and -180 >= longitude >= 180
13 # * returns true/false
15 return false if lat < -90 || lat > 90
16 return false if lon < -180 || lon > 180
21 self.tile = QuadTile.tile_for_point(lat, lon)
25 self.latitude = (l * SCALE).round
29 self.longitude = (l * SCALE).round
32 # Return WGS84 latitude
37 # Return WGS84 longitude
39 longitude.to_f / SCALE