Module: Adiwg_SpatialReferenceSystem

Defined in:
lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_spatialReference.rb

Overview

History: Stan Smith 2014-09-03 original script

Class Method Summary collapse

Class Method Details

.unpack(hSpatialRef) ⇒ Object



9
10
11
12
13
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
41
42
43
44
45
46
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_spatialReference.rb', line 9

def self.unpack(hSpatialRef)

  # instance classes needed in script
  intMetadataClass = .new
  intSpatialRef = intMetadataClass.newSpatialReferenceSystem

  # spatial reference system - by name
  if hSpatialRef.has_key?('name')
    aSystemNames = hSpatialRef['name']
    unless aSystemNames.empty?
      aSystemNames.each do |sRName|
        intSpatialRef[:sRNames] << sRName
      end
    end
  end

  # spatial reference system - by epsg
  if hSpatialRef.has_key?('epsgNumber')
    aSystemNames = hSpatialRef['epsgNumber']
    unless aSystemNames.empty?
      aSystemNames.each do |sREPSG|
        intSpatialRef[:sREPSGs] << sREPSG
      end
    end
  end

  # spatial reference system - by wkt
  if hSpatialRef.has_key?('wkt')
    aSystemNames = hSpatialRef['wkt']
    unless aSystemNames.empty?
      aSystemNames.each do |sRWKT|
        intSpatialRef[:sRWKTs] << sRWKT
      end
    end
  end

  return intSpatialRef
end