title: Converting CSV to KML using ruby_kml
body: <p>I am having trouble with is creating a KML using ruby_kml from a CSV file so that I can utilize the addKML() or addKMLLayer() methods offered by gmaps4rails. I am having trouble getting the syntax to make sense. In api example it lists points explicitly like so
        ["$26A8",3023.1214,9744.5808],<br>
        ["$26A9",3023.0842,9744.6805],<br>
        ["$26AA",3022.9717,9744.5025], </p>
  
  <p>my goal is to get it to read each row of the CSV and use that data for the kml. Here is my attempt at a solution. </p>
  
  <pre><code>def kml 
      require 'csv'
      require 'ruby_kml'
      curPoints = CSV.read('/postCSV/cur.csv'); # most recent upload
      kml = KMLFILE.new
      folder = KML::Folder.new(:name =&gt; 'ready')
      [
        **curPoints.each do |row|
          [row[0],row[1],row[3]]
        end** #data is in 0,1,3 
        # this shouldn't work because the loop isn't doing anything
        # I just don't see how to get it to match the example code     
          #for loop through row delimitating by name, lat, lng
      ].each do |name, lat, lng|
      folder.features &lt;&lt; KML::Placemark.new(
        :name =&gt; name,
        :gemoetry =&gt; KML::Point.new(:coordinates =&gt; {:lat =&gt; lat, :lng =&gt; lng})
      )
      end
        kml.objects &lt;&lt; folder
        @kml = kml.render
        return kml
      end
  </code></pre>