class OSMHistory

Main Controller for OSM History

Attributes

aw_config[R]

Public Class Methods

new(args) click to toggle source
# File osm-history.rb, line 40
def initialize(args)
        begin
                @aw_config = YAML.load_file(args[:analysis_window])
        rescue
                raise IOError.new("Can't load analysis window configuration file")
        end

        #Set Database Connection
        DatabaseConnection.new(database: aw_config['database'], host: aw_config['host'], port: aw_config['port'])

        analysis_window

        puts "Successfully initialized Analysis Window: #{aw_config['title']}"
end

Public Instance Methods

analysis_window() click to toggle source
# File osm-history.rb, line 55
def analysis_window
        @analysis_window ||= AnalysisWindow.new( time_frame: TimeFrame.new(start_date: aw_config['start_date'], end_date: aw_config['end_date']), 
                                                                                         bounding_box: BoundingBox.new(bbox: aw_config['bbox']), 
                                                                                         min_area: aw_config['min_area'], 
                                                                                         max_area: aw_config['max_area']
        )
end
run_bbox_questions() click to toggle source
# File osm-history.rb, line 81
def run_bbox_questions
        bbox_questions = Questions::Bbox.new(analysis_window: analysis_window)

        aw_config['Bbox Questions'].each do |bbox_q|
                write_json( data: bbox_questions.run(bbox_q), name: "#{bbox_q}.json")
        end
end
run_changeset_questions() click to toggle source
# File osm-history.rb, line 73
def run_changeset_questions
        changeset_questions = Questions::Changesets.new(analysis_window: analysis_window)

        aw_config['Changeset Questions'].each do |changeset_q|
                write_json( data: changeset_questions.run(changeset_q), name: "#{changeset_q}.json")
        end
end
run_network_functions() click to toggle source
# File osm-history.rb, line 97
def run_network_functions
        network_info = aw_config['temporal_network']
        temp = TemporalAnalysis.new(aw: analysis_window, step: network_info['step'], unit: network_info['unit'], directory: network_info['files'])
        temp.run_overlapping_changesets
end
run_node_questions() click to toggle source
# File osm-history.rb, line 64
def run_node_questions
        node_questions = Questions::Nodes.new(analysis_window: analysis_window)

        aw_config['Node Questions'].each do |node_q|
                write_json( data: node_questions.run(node_q), name: "#{node_q}.json")
        end
end
run_user_questions() click to toggle source
# File osm-history.rb, line 89
def run_user_questions
        user_questions = Questions::Users.new(analysis_window: analysis_window)

        aw_config['User Questions'].each do |user_q|
                write_json( data: user_questions.run(user_q), name: "#{user_q}.json")
        end
end
write_json(args) click to toggle source
# File osm-history.rb, line 103
def write_json(args)
        out_file = FileIO::JSONExporter.new(name: args[:name], data: args[:data], path: aw_config['write_directory']+'/json') 
        unless out_file.data.nil? 
                out_file.write
        end
end