module ADIWG::Mdtranslator::Readers::Fgdc::MapLocalPlanar

Public Class Methods

unpack(xMapLocal, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/readers/fgdc/modules/module_localPlanar.rb, line 17
def self.unpack(xMapLocal, hResponseObj)

   # instance classes needed in script
   intMetadataClass = InternalMetadata.new
   hProjection = intMetadataClass.newProjection
   hIdentifier = intMetadataClass.newIdentifier
   hLocal = intMetadataClass.newLocal
   hProjection[:projectionIdentifier] = hIdentifier
   hProjection[:local] = hLocal

   hIdentifier[:identifier] = 'localPlanar'
   hIdentifier[:name] = 'Local Planar Coordinate System'
   hLocal[:fixedToEarth] = true

   # local planar 4.1.2.3.1 (localpd) - local planar description (required)
   # -> ReferenceSystemParameters.projection.local.description
   description = xMapLocal.xpath('./localpd').text
   unless description.empty?
      hLocal[:description] = description
   end
   if description.empty?
      hResponseObj[:readerExecutionMessages] <<
         'WARNING: FGDC reader: local planar coordinate system description is missing'
   end

   # local planar 4.1.2.3.2 (localpgi) - local planar georeference information (required)
   # -> ReferenceSystemParameters.projection.local.georeference
   georeference = xMapLocal.xpath('./localpgi').text
   unless georeference.empty?
      hLocal[:georeference] = georeference
   end
   if georeference.empty?
      hResponseObj[:readerExecutionMessages] <<
         'WARNING: FGDC reader: local planar coordinate system georeference information is missing'
   end

   return hProjection

end