class ADIWG::Mdtranslator::Writers::Iso19115_2::FeatureCollection

Public Class Methods

new(xml, hResponseObj) click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb, line 16
def initialize(xml, hResponseObj)
   @xml = xml
   @hResponseObj = hResponseObj
end

Public Instance Methods

writeXML(hGeoObject) click to toggle source
# File lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb, line 21
def writeXML(hGeoObject)

   # classes used
   featureClass = Feature.new(@xml, @hResponseObj)

   # feature collection attributes
   attributes = {}

   # feature collection attributes - gml:id (required)
   @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
   objId = 'featureCollection' + @hResponseObj[:writerMissingIdCount]
   attributes['gml:id'] = objId

   # feature collection attributes - srsName (GeoJSON is WGS84)
   attributes[:srsName] = 'WGS84'

   @xml.tag!('gml:MultiGeometry', attributes) do

      # geometry collection - geometry objects (required)
      @xml.tag!('gml:geometryMembers') do
         unless hGeoObject[:features].empty?
            aFeatures = hGeoObject[:features]
            aFeatures.each do |hFeature|
               featureClass.writeXML(hFeature)
            end
         end
      end

   end # gml:MultiGeometry tag
end