コード例 #1
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def locs_metrics(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    outfile = ctx.obj["outfile"]
    lm = LocsMetrics(db)
    lm.generate(outfile)
コード例 #2
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def usermetrics(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    um = UserMetrics(db)
    um.generate()
    db.close()
コード例 #3
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def locs_metrics(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    outfile = ctx.obj['outfile']
    lm = LocsMetrics(db)
    lm.generate(outfile)
コード例 #4
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def photodensity(ctx):
    config = ctx.obj["config"]
    db = DB(ctx.obj["dbname"], config)
    db.open()
    pd = PhotoDensity(db)
    pd.generate()
    db.close()
コード例 #5
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def usersamples(ctx):
    dbname = ctx.obj["dbname"]
    infile = ctx.obj["infile"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    us = UserSamples(db, dbname, infile)
    us.generate()
    db.close()
コード例 #6
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def fix_locations(ctx):
    click.echo("Fixing locations")
    config = ctx.obj["config"]
    db = DB(ctx.obj["dbname"], config)
    db.open()
    fixer = FixLocations(db)
    fixer.run()
    db.close()
コード例 #7
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def areas(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    infile = ctx.obj["infile"]
    smooth = ctx.obj["smooth"]
    ar = Areas(db, infile, smooth)
    ar.compute()
コード例 #8
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def clean_locations(ctx):
    click.echo("Cleaning location data")
    db = DB(ctx.obj["dbname"], ctx.obj["config"])
    db.open()
    locs = Locations(db)
    locs.clean()
    db.close()
    click.echo("done.")
コード例 #9
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def retrieve(ctx):
    click.echo("Retrieving Instagram data")
    config = ctx.obj["config"]
    db = DB(ctx.obj["dbname"], config)
    db.open()
    retriever = Retriever(config, db)
    retriever.run()
    db.close()
コード例 #10
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def areas(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    infile = ctx.obj['infile']
    smooth = ctx.obj['smooth']
    ar = Areas(db, infile, smooth)
    ar.compute()
コード例 #11
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def add_locations(ctx):
    country_code = ctx.obj["country_code"]
    click.echo("Adding locations for %s" % country_code)
    db = DB(ctx.obj["dbname"], ctx.obj["config"])
    db.open()
    locs = Locations(db)
    (points, inserted) = locs.add_locations(ctx.obj["locs_file"], country_code)
    db.close()
    click.echo("%d points found, %d points added." % (points, inserted))
コード例 #12
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def crop_rectangle(ctx):
    min_lat = float(ctx.obj["min_lat"])
    min_lng = float(ctx.obj["min_lng"])
    max_lat = float(ctx.obj["max_lat"])
    max_lng = float(ctx.obj["max_lng"])
    db = DB(ctx.obj["dbname"], ctx.obj["config"])
    db.open()
    ghostb.cropdata.crop_rectangle(db, min_lat, min_lng, max_lat, max_lng)
    db.close()
コード例 #13
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def distances(ctx):
    dbname = ctx.obj["dbname"]
    infile = ctx.obj["infile"]
    outfile = ctx.obj["outfile"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    dist = Distances(db)
    dist.compute(infile, outfile)
    db.close()
コード例 #14
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def gen_graph(ctx):
    dbname = ctx.obj["dbname"]
    outfile = ctx.obj["outfile"]
    table = ctx.obj["table"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    gg = GenGraph(db, outfile, table)
    gg.generate()
    db.close()
コード例 #15
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def dists(ctx):
    dbname = ctx.obj["dbname"]
    infile = ctx.obj["infile"]
    outfile = ctx.obj["outfile"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    g = ghostb.graph.read_graph(infile)
    ghostb.graph.write_dists(g, db, outfile)
    db.close()
コード例 #16
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def borders(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    indir = ctx.obj['indir']
    infile = ctx.obj['infile']
    outfile = ctx.obj['outfile']
    smooth = ctx.obj['smooth']
    bs = Borders(db, smooth)
    bs.process(indir, infile, outfile)
コード例 #17
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def scales_usermetrics(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    outdir = ctx.obj["outdir"]
    intervals = int(ctx.obj["intervals"])
    scale_membership = ctx.obj["scale_membership"]

    s = Scales(outdir, intervals)
    s.usermetrics(db, scale_membership)
コード例 #18
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def dist_sequence(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    outdir = ctx.obj["outdir"]
    intervals = int(ctx.obj["intervals"])
    smooth = ctx.obj["smooth"]

    scales = Scales(outdir, intervals)
    scales.dist_sequence(db, smooth)
コード例 #19
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def borders(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    indir = ctx.obj["indir"]
    infile = ctx.obj["infile"]
    outfile = ctx.obj["outfile"]
    smooth = ctx.obj["smooth"]
    bs = Borders(db, smooth)
    bs.process(indir, infile, outfile)
コード例 #20
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def filter_dists(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    infile = ctx.obj["infile"]
    outfile = ctx.obj["outfile"]
    max_dist = float(ctx.obj["max_dist"])
    fd = FilterDists(db)
    fd.filter(infile, outfile, max_dist)
    db.close()
コード例 #21
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def dist_sequence(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    outdir = ctx.obj['outdir']
    intervals = int(ctx.obj['intervals'])
    smooth = ctx.obj['smooth']

    scales = Scales(outdir, intervals)
    scales.dist_sequence(db, smooth)
コード例 #22
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def replace_low_degree(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    infile = ctx.obj["infile"]
    outfile = ctx.obj["outfile"]
    min_degree = float(ctx.obj["min_degree"])
    rld = ReplaceLowDegree(db, infile, min_degree)
    rld.run(outfile)
    db.close()
コード例 #23
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def scales_usermetrics(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    outdir = ctx.obj['outdir']
    intervals = int(ctx.obj['intervals'])
    scale_membership = ctx.obj['scale_membership']

    s = Scales(outdir, intervals)
    s.usermetrics(db, scale_membership)
コード例 #24
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def add_region_grid(ctx):
    region = ctx.obj["region"]
    rows = int(ctx.obj["rows"])
    cols = int(ctx.obj["cols"])
    click.echo("Adding grid of locations for region: %s" % region)
    db = DB(ctx.obj["dbname"], ctx.obj["config"])
    db.open()
    locs = Locations(db)
    locs.add_region_grid(region, rows, cols)
    db.close()
コード例 #25
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def similarity_matrix(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    outdir = ctx.obj['outdir']
    intervals = int(ctx.obj['intervals'])
    smooth = ctx.obj['smooth']
    optimize = ctx.obj['optimize']

    scales = Scales(outdir, intervals)
    scales.similarity_matrix(db, smooth, optimize)
コード例 #26
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def scales_borders(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    outdir = ctx.obj['outdir']
    best = ctx.obj['best']
    smooth = ctx.obj['smooth']
    intervals = int(ctx.obj['intervals'])
    
    scales = Scales(outdir, intervals)
    scales.generate_borders(db, best, smooth)
コード例 #27
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def similarity_matrix(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    outdir = ctx.obj["outdir"]
    intervals = int(ctx.obj["intervals"])
    smooth = ctx.obj["smooth"]
    optimize = ctx.obj["optimize"]

    scales = Scales(outdir, intervals)
    scales.similarity_matrix(db, smooth, optimize)
コード例 #28
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def scales_graphs(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    outdir = ctx.obj['outdir']
    intervals = int(ctx.obj['intervals'])
    scale = ctx.obj['scale']
    table = ctx.obj['table']
    
    scales = Scales(outdir, intervals)
    scales.generate_graphs(db, scale, table)
コード例 #29
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def userscales(ctx):
    dbname = ctx.obj["dbname"]
    infile = ctx.obj["infile"]
    outfile = ctx.obj["outfile"]
    scales = ctx.obj["scales"]
    table = ctx.obj["table"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    us = UserScales(db, outfile, infile, scales, table)
    us.generate()
    db.close()
コード例 #30
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def scales_borders(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    outdir = ctx.obj["outdir"]
    best = ctx.obj["best"]
    smooth = ctx.obj["smooth"]
    intervals = int(ctx.obj["intervals"])

    scales = Scales(outdir, intervals)
    scales.generate_borders(db, best, smooth)
コード例 #31
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def scales_graphs(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    outdir = ctx.obj["outdir"]
    intervals = int(ctx.obj["intervals"])
    scale = ctx.obj["scale"]
    table = ctx.obj["table"]

    scales = Scales(outdir, intervals)
    scales.generate_graphs(db, scale, table)
コード例 #32
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def add_area(ctx):
    min_lat = float(ctx.obj["min_lat"])
    min_lng = float(ctx.obj["min_lng"])
    max_lat = float(ctx.obj["max_lat"])
    max_lng = float(ctx.obj["max_lng"])
    click.echo("Adding locations in area: [%s, %s, %s, %s]" % (min_lat, min_lng, max_lat, max_lng))
    db = DB(ctx.obj["dbname"], ctx.obj["config"])
    db.open()
    locs = Locations(db)
    (points, inserted) = locs.add_area(ctx.obj["locs_file"], min_lat, min_lng, max_lat, max_lng)
    db.close()
    click.echo("%d points found, %d points added." % (points, inserted))
コード例 #33
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def scales_multi_borders(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    outdir = ctx.obj["outdir"]
    outfile = ctx.obj["outfile"]
    smooth = ctx.obj["smooth"]
    intervals = int(ctx.obj["intervals"])
    scales = ctx.obj["scales"]

    s = Scales(outdir, intervals)
    s.generate_multi_borders(db, outfile, smooth, scales)
コード例 #34
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def scales_multi_borders(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    outdir = ctx.obj['outdir']
    outfile = ctx.obj['outfile']
    smooth = ctx.obj['smooth']
    intervals = int(ctx.obj['intervals'])
    scales = ctx.obj['scales']

    s = Scales(outdir, intervals)
    s.generate_multi_borders(db, outfile, smooth, scales)
コード例 #35
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def add_grid(ctx):
    min_lat = float(ctx.obj["min_lat"])
    min_lng = float(ctx.obj["min_lng"])
    max_lat = float(ctx.obj["max_lat"])
    max_lng = float(ctx.obj["max_lng"])
    rows = int(ctx.obj["rows"])
    cols = int(ctx.obj["cols"])
    click.echo("Adding grid of locations for area: [%s, %s, %s, %s]" % (min_lat, min_lng, max_lat, max_lng))
    db = DB(ctx.obj["dbname"], ctx.obj["config"])
    db.open()
    locs = Locations(db)
    locs.add_grid(min_lat, min_lng, max_lat, max_lng, rows, cols)
    db.close()
コード例 #36
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def scales_metric(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    outdir = ctx.obj['outdir']
    best = ctx.obj['best']
    intervals = int(ctx.obj['intervals'])
    smooth = ctx.obj['smooth']
    scale = ctx.obj['scale']
    metric = ctx.obj['metric']

    scales = Scales(outdir, intervals)
    scales.metric(metric, db, best, smooth, scale)
コード例 #37
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def scales_metric(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    outdir = ctx.obj["outdir"]
    best = ctx.obj["best"]
    intervals = int(ctx.obj["intervals"])
    smooth = ctx.obj["smooth"]
    scale = ctx.obj["scale"]
    metric = ctx.obj["metric"]

    scales = Scales(outdir, intervals)
    scales.metric(metric, db, best, smooth, scale)
コード例 #38
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def usermetrics(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    um = UserMetrics(db)
    um.generate()
    db.close()
コード例 #39
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def photodensity(ctx):
    config = ctx.obj['config']
    db = DB(ctx.obj['dbname'], config)
    db.open()
    pd = PhotoDensity(db)
    pd.generate()
    db.close()
コード例 #40
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def json_export(ctx):
    dbname = ctx.obj['dbname']
    outfile = ctx.obj['outfile']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    je = JsonExport(db, outfile)
    je.export()
    db.close()
コード例 #41
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def clean_locations(ctx):
    click.echo('Cleaning location data')
    db = DB(ctx.obj['dbname'], ctx.obj['config'])
    db.open()
    locs = Locations(db)
    locs.clean()
    db.close()
    click.echo('done.')
コード例 #42
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def retrieve(ctx):
    click.echo('Retrieving Instagram data')
    config = ctx.obj['config']
    db = DB(ctx.obj['dbname'], config)
    db.open()
    retriever = Retriever(config, db)
    retriever.run()
    db.close()
コード例 #43
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def fix_locations(ctx):
    click.echo('Fixing locations')
    config = ctx.obj['config']
    db = DB(ctx.obj['dbname'], config)
    db.open()
    fixer = FixLocations(db)
    fixer.run()
    db.close()
コード例 #44
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def usersamples(ctx):
    dbname = ctx.obj['dbname']
    infile = ctx.obj['infile']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    us = UserSamples(db, dbname, infile)
    us.generate()
    db.close()
コード例 #45
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def import_locations(ctx):
    infile = ctx.obj['infile']
    click.echo('Importing locations from %s' % infile)
    db = DB(ctx.obj['dbname'], ctx.obj['config'])
    db.open()
    locs = Locations(db)
    (points, inserted) = locs.import_locations(infile)
    db.close()
    click.echo('%d points found, %d points added.' % (points, inserted))
コード例 #46
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def crop_rectangle(ctx):
    min_lat = float(ctx.obj['min_lat'])
    min_lng = float(ctx.obj['min_lng'])
    max_lat = float(ctx.obj['max_lat'])
    max_lng = float(ctx.obj['max_lng'])
    db = DB(ctx.obj['dbname'], ctx.obj['config'])
    db.open()
    ghostb.cropdata.crop_rectangle(db, min_lat, min_lng, max_lat, max_lng)
    db.close()
コード例 #47
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def dists(ctx):
    dbname = ctx.obj['dbname']
    infile = ctx.obj['infile']
    outfile = ctx.obj['outfile']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    g = ghostb.graph.read_graph(infile)
    ghostb.graph.write_dists(g, db, outfile)
    db.close()
コード例 #48
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def distances(ctx):
    dbname = ctx.obj['dbname']
    infile = ctx.obj['infile']
    outfile = ctx.obj['outfile']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    dist = Distances(db)
    dist.compute(infile, outfile)
    db.close()
コード例 #49
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def gen_graph(ctx):
    dbname = ctx.obj['dbname']
    outfile = ctx.obj['outfile']
    table = ctx.obj['table']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    gg = GenGraph(db, outfile, table)
    gg.generate()
    db.close()
コード例 #50
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def add_locations(ctx):
    country_code = ctx.obj['country_code']
    click.echo('Adding locations for %s' % country_code)
    db = DB(ctx.obj['dbname'], ctx.obj['config'])
    db.open()
    locs = Locations(db)
    (points, inserted) = locs.add_locations(ctx.obj['locs_file'], country_code)
    db.close()
    click.echo('%d points found, %d points added.' % (points, inserted))
コード例 #51
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def filter_dists(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    infile = ctx.obj['infile']
    outfile = ctx.obj['outfile']
    max_dist = float(ctx.obj['max_dist'])
    fd = FilterDists(db)
    fd.filter(infile, outfile, max_dist)
    db.close()
コード例 #52
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def add_region_grid(ctx):
    region = ctx.obj['region']
    rows = int(ctx.obj['rows'])
    cols = int(ctx.obj['cols'])
    click.echo('Adding grid of locations for region: %s' % region)
    db = DB(ctx.obj['dbname'], ctx.obj['config'])
    db.open()
    locs = Locations(db)
    locs.add_region_grid(region, rows, cols)
    db.close()
コード例 #53
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def replace_low_degree(ctx):
    dbname = ctx.obj['dbname']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    infile = ctx.obj['infile']
    outfile = ctx.obj['outfile']
    min_degree = float(ctx.obj['min_degree'])
    rld = ReplaceLowDegree(db, infile, min_degree)
    rld.run(outfile)
    db.close()
コード例 #54
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def userscales(ctx):
    dbname = ctx.obj['dbname']
    infile = ctx.obj['infile']
    outfile = ctx.obj['outfile']
    scales = ctx.obj['scales']
    table = ctx.obj['table']
    db = DB(dbname, ctx.obj['config'])
    db.open()
    us = UserScales(db, outfile, infile, scales, table)
    us.generate()
    db.close()
コード例 #55
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def cropgraph(ctx):
    infile = ctx.obj['infile']
    outfile = ctx.obj['outfile']
    min_lat = float(ctx.obj['min_lat'])
    min_lng = float(ctx.obj['min_lng'])
    max_lat = float(ctx.obj['max_lat'])
    max_lng = float(ctx.obj['max_lng'])
    db = DB(ctx.obj['dbname'], ctx.obj['config'])
    db.open()
    cg = CropGraph(db)
    cg.crop(infile, outfile, min_lat, min_lng, max_lat, max_lng)
    db.close()
コード例 #56
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def add_area(ctx):
    min_lat = float(ctx.obj['min_lat'])
    min_lng = float(ctx.obj['min_lng'])
    max_lat = float(ctx.obj['max_lat'])
    max_lng = float(ctx.obj['max_lng'])
    click.echo('Adding locations in area: [%s, %s, %s, %s]' % (min_lat, min_lng, max_lat, max_lng))
    db = DB(ctx.obj['dbname'], ctx.obj['config'])
    db.open()
    locs = Locations(db)
    (points, inserted) = locs.add_area(ctx.obj['locs_file'],
                                       min_lat, min_lng, max_lat, max_lng)
    db.close()
    click.echo('%d points found, %d points added.' % (points, inserted))
コード例 #57
0
ファイル: ghostb.py プロジェクト: pharshid/ghostborders
def add_grid(ctx):
    min_lat = float(ctx.obj['min_lat'])
    min_lng = float(ctx.obj['min_lng'])
    max_lat = float(ctx.obj['max_lat'])
    max_lng = float(ctx.obj['max_lng'])
    rows = int(ctx.obj['rows'])
    cols = int(ctx.obj['cols'])
    click.echo('Adding grid of locations for area: [%s, %s, %s, %s]' % (min_lat, min_lng, max_lat, max_lng))
    db = DB(ctx.obj['dbname'], ctx.obj['config'])
    db.open()
    locs = Locations(db)
    locs.add_grid(min_lat, min_lng, max_lat, max_lng, rows, cols)
    db.close()
コード例 #58
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def create_db(ctx):
    click.echo("Creating database")
    db = DB(ctx.obj["dbname"], ctx.obj["config"])
    db.create_db()
    db.close()
コード例 #59
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def crop_region(ctx):
    region = ctx.obj["region"]
    db = DB(ctx.obj["dbname"], ctx.obj["config"])
    db.open()
    ghostb.cropdata.crop_region(db, region)
    db.close()
コード例 #60
0
ファイル: ghostb.py プロジェクト: telmomenezes/ghostborders
def locphotos(ctx):
    dbname = ctx.obj["dbname"]
    db = DB(dbname, ctx.obj["config"])
    db.open()
    lp = LocPhotos(db)
    lp.update()