Beispiel #1
0
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.')
Beispiel #2
0
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.")
Beispiel #3
0
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))
Beispiel #4
0
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))
Beispiel #5
0
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))
Beispiel #6
0
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()
Beispiel #7
0
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()
Beispiel #8
0
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))
Beispiel #9
0
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()
Beispiel #10
0
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()
Beispiel #11
0
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))