Sha256: d7ec74ddb0792fba4129a99192fe6a9ee309978b22123f47f4d8eec992e4a470

Contents?: true

Size: 1.7 KB

Versions: 36

Compression:

Stored size: 1.7 KB

Contents

# GeoJson FeatureCollection
# 19115-2 writer output in XML

# History:
#   Stan Smith 2016-12-06 original script

require_relative 'class_feature'

module ADIWG
   module Mdtranslator
      module Writers
         module Iso19115_2

            class FeatureCollection

               def initialize(xml, hResponseObj)
                  @xml = xml
                  @hResponseObj = hResponseObj
               end

               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 # writeXML
            end # FeatureCollection class

         end
      end
   end
end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.19.0.pre.beta.31 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.19.0.pre.beta.30 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.19.0.pre.beta.29 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.19.0.pre.beta.28 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.19.0.pre.beta.27 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.19.0.pre.beta.26 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.19.0.pre.beta.13 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.19.0.pre.beta.12 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.19.0.pre.beta.11 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.19.0.pre.beta.10 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.19.0.pre.beta.9 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.19.0.pre.beta.8 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.19.0.pre.beta.7 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.4 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.2 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.1 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.0 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.0rc9 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.0rc8 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.0rc7 lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb