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

Parameters:

  • unit_label (Symbol, String)

    Must match one of the known angular unit types from FFI::GDAL::SRS_UA. Since there are only two, pick either :radian or :degree.

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".to_sym)
  unit_value = self.class.const_get("RADIAN_TO_#{unit_name}".to_sym)

  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

Parameters:

  • unit_label (Symbol, String)

    Must match one of the known linear unit types from FFI::GDAL::SRS_UL. I.e. :us_foot.

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".to_sym)
  unit_value = self.class.const_get("METER_TO_#{unit_name}".to_sym)

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