Sha256: 348dbe0d4ac41b88424e12d314a48e2b88201d24ad34b81d0730f9b80d68a449

Contents?: true

Size: 416 Bytes

Versions: 1

Compression:

Stored size: 416 Bytes

Contents

require "csv"
require "json"

airport_data = {}

CSV.foreach("airports.dat") do |row|
  airport_data[row[4]] = {
    :name => row[1],
    :city => row[2],
    :country => row[3],
    :iata => row[4],
    :icao => row[5],
    :latitude => row[6],
    :longitude => row[7],
    :altitude => row[8],
    :timezone => row[9],
    :dst => row[10]
  }
end

File.open("airports.json", "w").puts JSON.generate(airport_data)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
airports-0.0.2 data/reformat.rb