#!/usr/bin/ruby require 'shapelib' sfp = ShapeLib::ShapeFile::new("airfields.shp", :Point, [['name', :String, 64]]) fp = File.open('/home/james/.MicroNotam/airports.txt') @hash = Hash.new fp.each_line do |l| l = l.chomp a = l.split(':') if(!a[1]) then if(@hash['name'].to_s.size>0 && @hash['licence']!='Restricted') then sfp.write ShapeLib::Point::new(@hash['lon'].to_f, @hash['lat'].to_f, {'name' => @hash['name']}) puts "#{@hash['lon'].to_f}, #{@hash['lat'].to_f}, #{@hash['name']}." end @hash = Hash.new else @hash[a[0]] = a[1][1..-1] end end fp.close sfp.close