module GeoUnits::Converter::Units

Public Instance Methods

degrees_to_radians(degrees) click to toggle source
# File lib/geo_units/converter/units.rb, line 4
def degrees_to_radians(degrees)
  degrees.to_f * GeoUnits::Constants.radians_per_degree
end
earth_radius(units) click to toggle source
# File lib/geo_units/converter/units.rb, line 28
def earth_radius units
  units = GeoUnits.key units
  GeoUnits::Maps::Earth.radius[units]
end
pi_div_rad() click to toggle source
# File lib/geo_units/converter/units.rb, line 18
def pi_div_rad
  GeoUnits::Constants.pi_div_rad
end
radians_ratio(units) click to toggle source
# File lib/geo_units/converter/units.rb, line 33
def radians_ratio units
  units = GeoUnits.key units
  radians_per_degree * earth_radius(units)
end
units_per_latitude_degree(units) click to toggle source
# File lib/geo_units/converter/units.rb, line 13
def units_per_latitude_degree(units)
  units = GeoUnits.key units
  GeoUnits::Maps.radian_multiplier[units]
end
units_per_longitude_degree(lat, units) click to toggle source
# File lib/geo_units/converter/units.rb, line 22
def units_per_longitude_degree(lat, units)
  miles_per_longitude_degree = (lat * Math.cos(lat * pi_div_rad)).abs
  units = GeoUnits.key units
  miles_per_longitude_degree.miles_to(units)
end
units_sphere_multiplier(units) click to toggle source
# File lib/geo_units/converter/units.rb, line 8
def units_sphere_multiplier(units)
  units = GeoUnits.key units
  GeoUnits::Map::Earth.radius[units]
end