Sha256: 4d389fb2a621274c12b745be762906f04ec83ddf6ef14b649980b88b0cbd5b78

Contents?: true

Size: 1.7 KB

Versions: 15

Compression:

Stored size: 1.7 KB

Contents

# GeoJson FeatureCollection
# 19115-1 writer output in XML

# History:
#   Stan Smith 2019-03-20 original script

require_relative 'class_feature'

module ADIWG
   module Mdtranslator
      module Writers
         module Iso19115_1

            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

15 entries across 15 versions & 1 rubygems

Version Path
adiwg-mdtranslator-2.18.2 lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.1 lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.0 lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.0rc9 lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.0rc8 lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.0rc7 lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.0rc6 lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.0rc5 lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.0rc4 lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.0rc3 lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.0rc2 lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb
adiwg-mdtranslator-2.18.0rc1 lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb
adiwg-mdtranslator-2.17.1 lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb
adiwg-mdtranslator-2.16.1 lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb
adiwg-mdtranslator-2.15.0 lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb