Class: RS_Identifier

Inherits:
Object
  • Object
show all
Defined in:
lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceIdentifier.rb

Overview

History: Stan Smith 2014-09-03 original script

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ RS_Identifier



10
11
12
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceIdentifier.rb', line 10

def initialize(xml)
  @xml = xml
end

Instance Method Details

#writeXML(refId, refType) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceIdentifier.rb', line 14

def writeXML(refId, refType)

  @xml.tag!('gmd:RS_Identifier') do

    # identity - code - required
    # identifiers can be name, epsg number, wkt
    case refType
      when 'name'
        @xml.tag!('gmd:code') do
          @xml.tag!('gco:CharacterString', refId)
        end

      when 'epsg'
        @xml.tag!('gmd:code') do
          s = 'urn:ocg:def:crs:EPSG::' + refId.to_s
          @xml.tag!('gco:CharacterString', s)
        end

      when 'wkt'
        @xml.tag!('gmd:code') do
          s = 'WKT::' + refId
          @xml.tag!('gco:CharacterString', s)
        end
    end
  end

end