Class: Geokit::Adapters::OracleEnhanced
- Defined in:
- lib/geokit-rails/adapters/oracleenhanced.rb
Constant Summary collapse
- TO_DEGREES =
Math::PI / 180
Instance Method Summary collapse
- #flat_distance_sql(origin, lat_degree_units, lng_degree_units) ⇒ Object
- #sphere_distance_sql(lat, lng, multiplier) ⇒ Object
Methods inherited from Abstract
#initialize, load, #method_missing
Constructor Details
This class inherits a constructor from Geokit::Adapters::Abstract
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Geokit::Adapters::Abstract
Instance Method Details
#flat_distance_sql(origin, lat_degree_units, lng_degree_units) ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/geokit-rails/adapters/oracleenhanced.rb', line 22 def flat_distance_sql(origin, lat_degree_units, lng_degree_units) %{ SQRT( POWER(#{lat_degree_units}*(#{origin.lat}-#{qualified_lat_column_name}), 2) POWER(#{lng_degree_units}*(#{origin.lng}-#{qualified_lng_column_name}), 2) ) } end |
#sphere_distance_sql(lat, lng, multiplier) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/geokit-rails/adapters/oracleenhanced.rb', line 5 def sphere_distance_sql(lat, lng, multiplier) %{ ( ACOS( COS(#{lat}) * COS(#{lng}) * COS(#{TO_DEGREES} * #{qualified_lat_column_name}) * COS(#{TO_DEGREES} * #{qualified_lng_column_name}) + COS(#{lat}) * SIN(#{lng}) * COS(#{TO_DEGREES} * #{qualified_lat_column_name}) * SIN(#{TO_DEGREES} * #{qualified_lng_column_name}) + SIN(#{lat}) * SIN(#{TO_DEGREES} * #{qualified_lat_column_name}) ) * #{multiplier}) } end |