Class: GlobalConvert::Location
- Inherits:
-
Object
- Object
- GlobalConvert::Location
- Defined in:
- lib/global_convert/location.rb
Instance Attribute Summary collapse
-
#input_lat ⇒ Object
readonly
Returns the value of attribute input_lat.
-
#input_lon ⇒ Object
readonly
Returns the value of attribute input_lon.
-
#input_projection_name ⇒ Object
readonly
Returns the value of attribute input_projection_name.
-
#output_projection_name ⇒ Object
readonly
Returns the value of attribute output_projection_name.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Location
constructor
A new instance of Location.
- #input_point ⇒ Object
- #input_projection ⇒ Object
- #lat ⇒ Object
- #lon ⇒ Object
- #output_point ⇒ Object
- #output_projection ⇒ Object
Constructor Details
#initialize(args = {}) ⇒ Location
Returns a new instance of Location.
5 6 7 8 9 10 |
# File 'lib/global_convert/location.rb', line 5 def initialize(args = {}) @input_projection_name = args[:input][:projection] @output_projection_name = args[:output][:projection] @input_lon = args[:input][:lon] @input_lat = args[:input][:lat] end |
Instance Attribute Details
#input_lat ⇒ Object (readonly)
Returns the value of attribute input_lat.
3 4 5 |
# File 'lib/global_convert/location.rb', line 3 def input_lat @input_lat end |
#input_lon ⇒ Object (readonly)
Returns the value of attribute input_lon.
3 4 5 |
# File 'lib/global_convert/location.rb', line 3 def input_lon @input_lon end |
#input_projection_name ⇒ Object (readonly)
Returns the value of attribute input_projection_name.
3 4 5 |
# File 'lib/global_convert/location.rb', line 3 def input_projection_name @input_projection_name end |
#output_projection_name ⇒ Object (readonly)
Returns the value of attribute output_projection_name.
3 4 5 |
# File 'lib/global_convert/location.rb', line 3 def output_projection_name @output_projection_name end |
Instance Method Details
#input_point ⇒ Object
28 29 30 |
# File 'lib/global_convert/location.rb', line 28 def input_point @point ||= Proj4::Point.new(input_lon, input_lat) end |
#input_projection ⇒ Object
20 21 22 |
# File 'lib/global_convert/location.rb', line 20 def input_projection @input_projection ||= Projection.new input_projection_name end |
#lat ⇒ Object
12 13 14 |
# File 'lib/global_convert/location.rb', line 12 def lat output_point.lat end |
#lon ⇒ Object
16 17 18 |
# File 'lib/global_convert/location.rb', line 16 def lon output_point.lon end |
#output_point ⇒ Object
32 33 34 |
# File 'lib/global_convert/location.rb', line 32 def output_point @outpoint_point ||= input_projection.transform(output_projection, input_point) end |
#output_projection ⇒ Object
24 25 26 |
# File 'lib/global_convert/location.rb', line 24 def output_projection @output_projection ||= Projection.new output_projection_name end |