Module: Geodesy
- Extended by:
- Geodesy
- Included in:
- Geodesy
- Defined in:
- lib/geodesy/destination.rb,
lib/geodesy.rb,
lib/geodesy/bearing.rb,
lib/geodesy/version.rb,
lib/geodesy/latitude.rb,
lib/geodesy/longitude.rb,
lib/geodesy/conversions.rb,
lib/geodesy/coordinates.rb
Overview
Will return a coordinate based on a starting point, the bearing, and the distance.
Defined Under Namespace
Modules: Conversions Classes: Bearing, Coordinates, Destination, Latitude, Longitude
Constant Summary collapse
- VERSION =
"0.0.1"- COMPASS_POINTS =
%w[N NE E SE S SW W NW]
- EARTH_RADIUS =
6371.0- KM_TO_MI =
0.621371192- DEGREES_PER_RADIAN =
57.2957795- YARDS_PER_METER =
1.09361- METERS_TO_YARDS =
0.9144
Instance Method Summary collapse
-
#bearing(starting, ending) ⇒ Object
starting is an array of [ lat, lng ] ending is an array of [ lat, lng ].
-
#final_coordinate(starting, bearing, distance = 10) ⇒ Object
starting is an array of [ lat, lng ] bearing is a float distance is an integer or float - units: meters.
Instance Method Details
#bearing(starting, ending) ⇒ Object
starting is an array of [ lat, lng ] ending is an array of [ lat, lng ]
Returns
It returns a floating point number
20 21 22 23 24 25 |
# File 'lib/geodesy.rb', line 20 def bearing(starting, ending) Bearing.new( Coordinates.new(*starting), Coordinates.new(*ending) ).calculate end |
#final_coordinate(starting, bearing, distance = 10) ⇒ Object
starting is an array of [ lat, lng ] bearing is a float distance is an integer or float - units: meters
Returns
It returns a Coordinates Object
37 38 39 40 41 42 43 |
# File 'lib/geodesy.rb', line 37 def final_coordinate(starting, bearing, distance = 10) Destination.new( Coordinates.new(*starting), bearing, distance ).calculate end |