Sha256: 914bb9ae396ea93fb45b04df7c042c3bc51c8b8fe12e6a93a877598d87c34059

Contents?: true

Size: 1.92 KB

Versions: 4

Compression:

Stored size: 1.92 KB

Contents

# Reader - fgdc to internal data structure
# unpack fgdc horizontal data geographic resolution

# History:
#  Stan Smith 2017-12-29 original script

require 'nokogiri'
require 'adiwg/mdtranslator/internal/internal_metadata_obj'

module ADIWG
   module Mdtranslator
      module Readers
         module Fgdc

            module GeographicResolution

               def self.unpack(xGeographic)

                  # instance classes needed in script
                  intMetadataClass = InternalMetadata.new

                  hResolution = intMetadataClass.newSpatialResolution
                  hGeoResolution = intMetadataClass.newGeographicResolution

                  # geographic reference 4.1.1.1 (latres) - latitude resolution
                  # -> spatialResolution.geographicResolution.latitudeResolution
                  latResolution = xGeographic.xpath('./latres').text
                  unless latResolution.empty?
                     hGeoResolution[:latitudeResolution] = latResolution.to_f
                  end

                  # geographic reference 4.1.1.2 (longres) - longitude resolution
                  # -> spatialResolution.geographicResolution.longitudeResolution
                  longResolution = xGeographic.xpath('./longres').text
                  unless longResolution.empty?
                     hGeoResolution[:longitudeResolution] = longResolution.to_f
                  end

                  # geographic reference 4.1.1.3 (geogunit) - latitude/longitude units
                  # -> spatialResolution.geographicResolution.unitOfMeasure
                  unitMeasure = xGeographic.xpath('./geogunit').text
                  unless unitMeasure.empty?
                     hGeoResolution[:unitOfMeasure] = unitMeasure
                  end

                  hResolution[:geographicResolution] = hGeoResolution

                  return hResolution

               end

            end

         end
      end
   end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.9.2 lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb
adiwg-mdtranslator-2.9.1 lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb
adiwg-mdtranslator-2.9.0 lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb
adiwg-mdtranslator-2.8.0 lib/adiwg/mdtranslator/readers/fgdc/modules/module_geographicResolution.rb