2 def self.included(base)
3 base.extend(ClassMethods)
10 # Is this node within -90 >= latitude >= 90 and -180 >= longitude >= 180
11 # * returns true/false
13 return false if self.lat < -90 or self.lat > 90
14 return false if self.lon < -180 or self.lon > 180
19 self.tile = QuadTile.tile_for_point(lat, lon)
23 self.latitude = (l * 10000000).round
27 self.longitude = (l * 10000000).round
30 # Return WGS84 latitude
32 return self.latitude.to_f / 10000000
35 # Return WGS84 longitude
37 return self.longitude.to_f / 10000000
40 # Potlatch projections
41 def lon_potlatch(baselong,masterscale)
42 (self.lon-baselong)*masterscale
45 def lat_potlatch(basey,masterscale)
46 -(lat2y(self.lat)-basey)*masterscale
52 180/Math::PI * Math.log(Math.tan(Math::PI/4+a*(Math::PI/180)/2))
56 def find_by_area(minlat, minlon, maxlat, maxlon, options)
57 self.with_scope(:find => {:conditions => OSM.sql_for_area(minlat, minlon, maxlat, maxlon)}) do
58 return self.find(:all, options)