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 Base
#_to_wkt, #eql?, #inspect, #to_s, #to_wkt
Constructor Details
#initialize(name_, semi_major_axis_, semi_minor_axis_, inverse_flattening_, ivf_definitive_, linear_unit_, *optional_) ⇒ Ellipsoid
:nodoc:
661 662 663 664 665 666 667 668 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 661 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.
694 695 696 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 694 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.
683 684 685 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 683 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.
690 691 692 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 690 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.
673 674 675 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 673 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.
677 678 679 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 677 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.
716 717 718 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 716 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.
727 728 729 730 731 732 733 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 727 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.
742 743 744 745 746 747 748 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 742 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:
701 702 703 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 701 def _wkt_content(open_, close_) # :nodoc: [@semi_major_axis, @inverse_flattening] end |
#_wkt_typename ⇒ Object
:nodoc:
697 698 699 |
# File 'lib/rgeo/coord_sys/cs/entities.rb', line 697 def _wkt_typename # :nodoc: "SPHEROID" end |