]> git.openstreetmap.org Git - rails.git/blobdiff - app/models/geo_record.rb
adds two migrations to create old_node_tags and node_tags table and indexes. Does...
[rails.git] / app / models / geo_record.rb
index 12a2a643e259d5b1cccc3fabcaa49a5a64fcaf43..e675b11e0d354b8d3d43e3bce9717c51302bfb16 100644 (file)
@@ -19,11 +19,30 @@ class GeoRecord < ActiveRecord::Base
     self.longitude = (l * 10000000).round
   end
 
+  # Return WGS84 latitude
   def lat
     return self.latitude.to_f / 10000000
   end
 
+  # Return WGS84 longitude
   def lon
     return self.longitude.to_f / 10000000
   end
+
+  # fuck knows
+  def lon_potlatch(baselong,masterscale)
+    (self.lon-baselong)*masterscale+350
+  end
+
+  def lat_potlatch(basey,masterscale)
+    -(lat2y(self.lat)-basey)*masterscale+250
+  end
+  
+  private
+  
+  def lat2y(a)
+    180/Math::PI * Math.log(Math.tan(Math::PI/4+a*(Math::PI/180)/2))
+  end
+
 end
+