Module: OGR::SpatialReference::Extensions

Included in:
OGR::SpatialReference
Defined in:
lib/ogr/extensions/spatial_reference/extensions.rb

Instance Method Summary collapse

Instance Method Details

#angular_units=(unit_label) ⇒ Object

Raises:

  • (NameError)

    If the unit_label isn’t of a known type.



12
13
14
15
16
17
18
19
20
# File 'lib/ogr/extensions/spatial_reference/extensions.rb', line 12

def angular_units=(unit_label)
  unit_name = unit_label.to_s.upcase
  unit_label = self.class.const_get(:"#{unit_name}_LABEL")
  unit_value = self.class.const_get(:"RADIAN_TO_#{unit_name}")

  set_angular_units(unit_label, unit_value)
rescue NameError
  raise NameError, "Param must be a known angular unit type: #{unit_label}"
end

#linear_units=(unit_label) ⇒ Object

Raises:

  • (NameError)

    If the unit_label isn’t of a known type.



25
26
27
28
29
30
31
32
33
# File 'lib/ogr/extensions/spatial_reference/extensions.rb', line 25

def linear_units=(unit_label)
  unit_name = unit_label.to_s.upcase
  unit_label = self.class.const_get(:"#{unit_name}_LABEL")
  unit_value = self.class.const_get(:"METER_TO_#{unit_name}")

  set_linear_units(unit_label, unit_value)
rescue NameError
  raise NameError, "Param must be a known linear unit type: #{unit_label}"
end