require 'find' def points_optimize() # write this - TODO end def points_load() points = [] Find.find("./") do |path| if FileTest.directory?(path) next end f = File.new(path,"r") d = f.read begin terms = d.split(' ') lat = terms[5].split(',')[0].to_f lon = terms[6].to_f if lat && lat != 0.0 && lon && lon != 0.0 if lat < 60 && lat > 0 && lon > -140 && lon < -20 points << [lat,lon] end end rescue end f.close end return points end def points_dump(points) puts "var data = [\n" (0..points.length).step(1) do |i| lat = points[i][0] lon = points[i][1] puts "\t#{lat},#{lon},\n" end puts "];\n" end def points_save_xml(points) begin o = File.new("data.xml","w") o.write "\n" o.write "\n" points.each {|p| o.write "\t\n" } o.write "\n" o.close rescue end end