Sha256: 3f0e3a43ad9baa210f65af9bbe808ffbe2ccf73d2f70d358690d9eaca0b572d1
Contents?: true
Size: 1.42 KB
Versions: 2
Compression:
Stored size: 1.42 KB
Contents
# frozen_string_literal: true require "ogr/spatial_reference" module OGR class SpatialReference module Extensions # @param 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. # @raise [NameError] If the +unit_label+ isn't of a known type. 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 # @param unit_label [Symbol, String] Must match one of the known linear # unit types from FFI::GDAL::SRS_UL. I.e. :us_foot. # @raise [NameError] If the +unit_label+ isn't of a known type. 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 end end end OGR::SpatialReference.include(OGR::SpatialReference::Extensions)
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ffi-gdal-1.0.4 | lib/ogr/extensions/spatial_reference/extensions.rb |
ffi-gdal-1.0.3 | lib/ogr/extensions/spatial_reference/extensions.rb |