1 class GeoRecord < ActiveRecord::Base
2 before_save :update_tile
4 def self.find_by_area(minlat, minlon, maxlat, maxlon, options)
5 self.with_scope(:find => {:conditions => OSM.sql_for_area(minlat, minlon, maxlat, maxlon)}) do
6 return self.find(:all, options)
11 self.tile = QuadTile.tile_for_point(lat, lon)
15 self.latitude = (l * 10000000).round
19 self.longitude = (l * 10000000).round
22 # Return WGS84 latitude
24 return self.latitude.to_f / 10000000
27 # Return WGS84 longitude
29 return self.longitude.to_f / 10000000
33 def lon_potlatch(baselong,masterscale)
34 (self.lon-baselong)*masterscale+350
37 def lat_potlatch(basey,masterscale)
38 -(lat2y(self.lat)-basey)*masterscale+250
44 180/Math::PI * Math.log(Math.tan(Math::PI/4+a*(Math::PI/180)/2))