Class: RGeo::CoordSys::CS::Ellipsoid
- Defined in:
- lib/rgeo/coord_sys/cs/entities.rb
Overview
OGC spec description
An approximation of the Earth’s surface as a squashed sphere.
Instance Attribute Summary collapse
-
#axis_unit ⇒ Object
readonly
Returns the LinearUnit.
-
#inverse_flattening ⇒ Object
readonly
Returns the value of the inverse of the flattening constant.
-
#ivf_definitive ⇒ Object
readonly
Is the Inverse Flattening definitive for this ellipsoid? Some ellipsoids use the IVF as the defining value, and calculate the polar radius whenever asked.
-
#semi_major_axis ⇒ Object
readonly
Gets the equatorial radius.
-
#semi_minor_axis ⇒ Object
readonly
Gets the polar radius.
Attributes inherited from Info
#abbreviation, #alias, #authority, #authority_code, #name, #remarks
Class Method Summary collapse
-
.create(name_, semi_major_axis_, semi_minor_axis_, inverse_flattening_, ivf_definitive_, linear_unit_, *optional_) ⇒ Object
Create an Ellipsoid given a name, semi-major and semi-minor axes, the inverse flattening, a boolean indicating whether the inverse flattening is definitive, and the LinearUnit indicating the axis units.
-
.create_ellipsoid(name_, semi_major_axis_, semi_minor_axis_, linear_unit_, *optional_) ⇒ Object
Create an Ellipsoid given a name, semi-major and semi-minor axes, and the LinearUnit indicating the axis units.
-
.create_flattened_sphere(name_, semi_major_axis_, inverse_flattening_, linear_unit_, *optional_) ⇒ Object
Create an Ellipsoid given a name, semi-major axis, inverse flattening, and the LinearUnit indicating the axis units.
Instance Method Summary collapse
-
#_wkt_content(_open_, _close_) ⇒ Object
:nodoc:.
-
#_wkt_typename ⇒ Object
:nodoc:.
-
#initialize(name_, semi_major_axis_, semi_minor_axis_, inverse_flattening_, ivf_definitive_, linear_unit_, *optional_) ⇒ Ellipsoid
constructor
:nodoc:.
Methods inherited from Info
Methods inherited from Base
#_to_wkt, #encode_with, #eql?, #hash, #init_with, #inspect, #marshal_dump, #marshal_load, #to_s, #to_wkt
Constructor Details
#initialize(name_, semi_major_axis_, semi_minor_axis_, inverse_flattening_, ivf_definitive_, linear_unit_, *optional_) ⇒ Ellipsoid
:nodoc:
601 602 603 604 605 606 607 608 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 601 def initialize(name_, semi_major_axis_, semi_minor_axis_, inverse_flattening_, ivf_definitive_, linear_unit_, *optional_) # :nodoc: super(name_, *optional_) @semi_major_axis = semi_major_axis_.to_f @semi_minor_axis = semi_minor_axis_.to_f @inverse_flattening = inverse_flattening_.to_f @ivf_definitive = ivf_definitive_ ? true : false @linear_unit = linear_unit_ end |
Instance Attribute Details
#axis_unit ⇒ Object (readonly)
Returns the LinearUnit. The units of the semi-major and semi-minor axis values.
633 634 635 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 633 def axis_unit @axis_unit end |
#inverse_flattening ⇒ Object (readonly)
Returns the value of the inverse of the flattening constant. The inverse flattening is related to the equatorial/polar radius by the formula ivf=re/(re-rp). For perfect spheres, this formula breaks down, and a special IVF value of zero is used.
622 623 624 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 622 def inverse_flattening @inverse_flattening end |
#ivf_definitive ⇒ Object (readonly)
Is the Inverse Flattening definitive for this ellipsoid? Some ellipsoids use the IVF as the defining value, and calculate the polar radius whenever asked. Other ellipsoids use the polar radius to calculate the IVF whenever asked. This distinction can be important to avoid floating-point rounding errors.
629 630 631 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 629 def ivf_definitive @ivf_definitive end |
#semi_major_axis ⇒ Object (readonly)
Gets the equatorial radius. The returned length is expressed in this object’s axis units.
612 613 614 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 612 def semi_major_axis @semi_major_axis end |
#semi_minor_axis ⇒ Object (readonly)
Gets the polar radius. The returned length is expressed in this object’s axis units.
616 617 618 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 616 def semi_minor_axis @semi_minor_axis end |
Class Method Details
.create(name_, semi_major_axis_, semi_minor_axis_, inverse_flattening_, ivf_definitive_, linear_unit_, *optional_) ⇒ Object
Create an Ellipsoid given a name, semi-major and semi-minor axes, the inverse flattening, a boolean indicating whether the inverse flattening is definitive, and the LinearUnit indicating the axis units. The LinearUnit is optional and may be set to nil. You may also provide the optional parameters specified by the Info interface.
651 652 653 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 651 def create(name_, semi_major_axis_, semi_minor_axis_, inverse_flattening_, ivf_definitive_, linear_unit_, *optional_) new(name_, semi_major_axis_, semi_minor_axis_, inverse_flattening_, ivf_definitive_, linear_unit_, *optional_) end |
.create_ellipsoid(name_, semi_major_axis_, semi_minor_axis_, linear_unit_, *optional_) ⇒ Object
Create an Ellipsoid given a name, semi-major and semi-minor axes, and the LinearUnit indicating the axis units. In the resulting ellipsoid, the inverse flattening is not definitive. The LinearUnit is optional and may be set to nil. You may also provide the optional parameters specified by the Info interface.
661 662 663 664 665 666 667 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 661 def create_ellipsoid(name_, semi_major_axis_, semi_minor_axis_, linear_unit_, *optional_) semi_major_axis_ = semi_major_axis_.to_f semi_minor_axis_ = semi_minor_axis_.to_f inverse_flattening_ = semi_major_axis_ / (semi_major_axis_ - semi_minor_axis_) inverse_flattening_ = 0.0 if inverse_flattening_.infinite? new(name_, semi_major_axis_, semi_minor_axis_, inverse_flattening_, false, linear_unit_, *optional_) end |
.create_flattened_sphere(name_, semi_major_axis_, inverse_flattening_, linear_unit_, *optional_) ⇒ Object
Create an Ellipsoid given a name, semi-major axis, inverse flattening, and the LinearUnit indicating the axis units. In the resulting ellipsoid, the inverse flattening is definitive. The LinearUnit is optional and may be set to nil. You may also provide the optional parameters specified by the Info interface.
675 676 677 678 679 680 681 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 675 def create_flattened_sphere(name_, semi_major_axis_, inverse_flattening_, linear_unit_, *optional_) semi_major_axis_ = semi_major_axis_.to_f inverse_flattening_ = inverse_flattening_.to_f semi_minor_axis_ = semi_major_axis_ - semi_major_axis_ / inverse_flattening_ semi_minor_axis_ = semi_major_axis_ if semi_minor_axis_.infinite? new(name_, semi_major_axis_, semi_minor_axis_, inverse_flattening_, true, linear_unit_, *optional_) end |
Instance Method Details
#_wkt_content(_open_, _close_) ⇒ Object
:nodoc:
639 640 641 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 639 def _wkt_content(_open_, _close_) # :nodoc: [@semi_major_axis, @inverse_flattening] end |
#_wkt_typename ⇒ Object
:nodoc:
635 636 637 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 635 def _wkt_typename # :nodoc: "SPHEROID" end |