Class: LongLat
- Inherits:
-
Object
- Object
- LongLat
- Defined in:
- lib/long_lat.rb
Constant Summary collapse
- RHO =
earth radius in meters
6378200
Instance Attribute Summary collapse
-
#latitude ⇒ Object
Returns the value of attribute latitude.
-
#longitude ⇒ Object
Returns the value of attribute longitude.
Class Method Summary collapse
Instance Method Summary collapse
- #distance_to(other) ⇒ Object
-
#initialize(longitude, latitude) ⇒ LongLat
constructor
A new instance of LongLat.
- #point_matrix ⇒ Object
Constructor Details
#initialize(longitude, latitude) ⇒ LongLat
Returns a new instance of LongLat.
7 8 9 |
# File 'lib/long_lat.rb', line 7 def initialize(longitude, latitude) @longitude, @latitude = longitude, latitude end |
Instance Attribute Details
#latitude ⇒ Object
Returns the value of attribute latitude.
5 6 7 |
# File 'lib/long_lat.rb', line 5 def latitude @latitude end |
#longitude ⇒ Object
Returns the value of attribute longitude.
5 6 7 |
# File 'lib/long_lat.rb', line 5 def longitude @longitude end |
Class Method Details
.from_data(data) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/long_lat.rb', line 11 def self.from_data(data) new( BinData::Int32le.read(data) / 3600000.0, BinData::Int32le.read(data) / 3600000.0 ) end |
Instance Method Details
#distance_to(other) ⇒ Object
18 19 20 |
# File 'lib/long_lat.rb', line 18 def distance_to(other) distance_point_to_point(point_matrix, other.point_matrix) end |