def to_kml(*args)
      xml, options = Geos::Helper.xml_options(*args)

      xml.Polygon(:id => options[:id]) do
        xml.extrude(options[:extrude]) if options[:extrude]
        xml.tessellate(options[:tessellate]) if options[:tessellate]
        xml.altitudeMode(Geos::Helper.camelize(options[:altitude_mode])) if options[:altitude_mode]
        xml.outerBoundaryIs do
          xml.LinearRing do
            xml.coordinates do
              xml << self.exterior_ring.coord_seq.to_a.collect do |p|
                p.join(',')
              end.join(' ')
            end
          end
        end
        (0...self.num_interior_rings).to_a.each do |n|
          xml.innerBoundaryIs do
            xml.LinearRing do
              xml.coordinates do
                xml << self.interior_ring_n(n).coord_seq.to_a.collect do |p|
                  p.join(',')
                end.join(' ')
              end
            end
          end
        end if options[:interior_rings] && self.num_interior_rings > 0
      end
    end
def to_kml(*args)
      xml, options = Geos::Helper.xml_options(*args)

      xml.Polygon(:id => options[:id]) do
        xml.extrude(options[:extrude]) if options[:extrude]
        xml.tessellate(options[:tessellate]) if options[:tessellate]
        xml.altitudeMode(Geos::Helper.camelize(options[:altitude_mode])) if options[:altitude_mode]
        xml.outerBoundaryIs do
          xml.LinearRing do
            xml.coordinates do
              xml << self.exterior_ring.coord_seq.to_a.collect do |p|
                p.join(',')
              end.join(' ')
            end
          end
        end
        (0...self.num_interior_rings).to_a.each do |n|
          xml.innerBoundaryIs do
            xml.LinearRing do
              xml.coordinates do
                xml << self.interior_ring_n(n).coord_seq.to_a.collect do |p|
                  p.join(',')
                end.join(' ')
              end
            end
          end
        end if options[:interior_rings] && self.num_interior_rings > 0
      end
    end
Build some XmlMarkup for XML. You can set various KML options like
 tessellate, altitudeMode, etc. Use Rails/Ruby-style code and it
 will be converted automatically, i.e. :altitudeMode, not
 :altitude_mode. You can also include interior rings by setting
 :interior_rings to true. The default is false.