module GeoUnits::Numeric
Public Instance Methods
is_between?(lower, upper)
click to toggle source
# File lib/geo_units/numeric.rb, line 13 def is_between? lower, upper (lower..upper).cover? self end
to_deg()
click to toggle source
Converts radians to numeric (signed) degrees latitude (north to south) from equator +90 up then -90 down (equator again) = 180 then 180 for south = 360 total longitude (west to east) east +180, west -180 = 360 total
# File lib/geo_units/numeric.rb, line 31 def to_deg self * 180 / Math::PI end
to_lat()
click to toggle source
# File lib/geo_units/numeric.rb, line 5 def to_lat normalize_lat end
to_lng()
click to toggle source
# File lib/geo_units/numeric.rb, line 9 def to_lng normalize_lng end
to_precision(precision)
click to toggle source
Formats the significant digits of a number, using only fixed-point notation (no exponential)
@param {Number} precision: Number of significant digits to appear in the returned string @returns {String} A string representation of number which contains precision significant digits
# File lib/geo_units/numeric.rb, line 45 def to_precision precision self.round(precision).to_s end
Also aliased as: to_fixed
to_rad()
click to toggle source
Converts numeric degrees to radians
# File lib/geo_units/numeric.rb, line 18 def to_rad self * Math::PI / 180 end