Sha256: 5a9a1403b0d280cf6f87c2eed2169d179fe3933310f20659251c3cd35cdd7a09

Contents?: true

Size: 855 Bytes

Versions: 6

Compression:

Stored size: 855 Bytes

Contents

module Geokit
  module Adapters
    class OracleEnhanced < Abstract
      TO_DEGREES = Math::PI / 180
      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

      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
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
geokit-rails-2.5.0 lib/geokit-rails/adapters/oracleenhanced.rb
geokit-rails-2.3.2 lib/geokit-rails/adapters/oracleenhanced.rb
geokit-rails-2.3.1 lib/geokit-rails/adapters/oracleenhanced.rb
geokit-rails-2.3.0 lib/geokit-rails/adapters/oracleenhanced.rb
geokit-rails-2.2.0 lib/geokit-rails/adapters/oracleenhanced.rb
geokit-rails-2.1.0 lib/geokit-rails/adapters/oracleenhanced.rb