Sha256: dd14f3c25f4552f60a465f6ef5fe8dfc61e4ffc59646df7ef411ad017afa8949

Contents?: true

Size: 1.02 KB

Versions: 5

Compression:

Stored size: 1.02 KB

Contents

module GeoUnits
  module Maps
    module Earth
      # from mongoid-geo, as suggested by niedhui :)
      def distance_per_latitude_degree
      {
        :feet       => 364491.8,
        :meters     => 111170,
        :kilometers => 111.17,
        :miles      => 69.407,
        :degrees    => 1
      }
      end

      def radius
        {
        :miles      => 3963.1676,
        :kilometers => 6378.135,
        :meters     => 6378135,
        :feet       => 20925639.8
        }
      end

      def major_axis_radius
        {
        :miles      => 3963.19059,
        :kilometers => 6378.137,
        :meters     => 6378137,
        :feet       => 20925646.36
        }
      end

      def minor_axis_radius
        {
        :kilometers => 6356.7523142,
        :miles      => 3949.90276,
        :meters     => 6356752.3142,
        :feet       => 20855486.627
        }
      end

      def latitude_degrees unit = :miles
        radius[unit] / distance_per_latitude_degree[unit]
      end

      extend self
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
geo_units-0.3.4 lib/geo_units/maps/earth.rb
geo_units-0.3.3 lib/geo_units/maps/earth.rb
geo_units-0.3.2 lib/geo_units/maps/earth.rb
geo_units-0.3.1.1 lib/geo_units/maps/earth.rb
geo_units-0.3.1 lib/geo_units/maps/earth.rb