Example #1
0
 def test_ways2bfmap(self):
     properties = dict(line.strip().split('=')
                       for line in open('/mnt/bfmap/test/test.properties'))
     bfmap.schema("localhost", 5432, properties[
                  "database"], "bfmap_ways", properties["user"], properties["password"], False)
     config = bfmap.config(properties["config"])
     bfmap.ways2bfmap("localhost", 5432, properties["database"], "temp_ways", properties["user"], properties[
                      "password"], "localhost", 5432, properties["database"], "bfmap_ways", properties["user"], properties["password"], config, False)
     return
Example #2
0
 def test_ways2bfmap(self):
     properties = dict(line.strip().split('=')
                       for line in open('/mnt/bfmap/test/test.properties'))
     bfmap.schema("localhost", 5432, properties["database"], "bfmap_ways",
                  properties["user"], properties["password"], False)
     config = bfmap.config(properties["config"])
     bfmap.ways2bfmap("localhost", 5432, properties["database"],
                      "temp_ways", properties["user"],
                      properties["password"], "localhost", 5432,
                      properties["database"], "bfmap_ways",
                      properties["user"], properties["password"], config,
                      False)
     return
Example #3
0
    print("Table '%s' already exists in database '%s'." %
          (options.target_table, options.target_database))
    while True:
        value = raw_input(
            "Do you want to remove table '%s' (y/n)? [n]: " % options.target_table).lower()
        if value == '' or value == 'n':
            print("Cancelled by user.")
            exit(0)
        elif value == 'y':
            break
    bfmap.remove(options.target_host, options.target_port, options.target_database,
                 options.target_table, options.target_user, target_password, options.printonly)
    print("Table '%s' has been removed." % options.target_table)

bfmap.schema(options.target_host, options.target_port, options.target_database,
             options.target_table, options.target_user, target_password, options.printonly)
print("Table '%s' has been created." % options.target_table)

print("Inserting data ...")
bfmap.ways2bfmap(options.source_host, options.source_port, options.source_database,
                 options.source_table, options.source_user, source_password,
                 options.target_host, options.target_port, options.target_database,
                 options.target_table, options.target_user, target_password, config,
                 options.printonly)
print("Done.")

print("Setting up spatial index on table '%s' ... " % options.target_table)
bfmap.index(options.target_host, options.target_port, options.target_database,
            options.target_table, options.target_user, target_password, options.printonly)
print("Done.")
Example #4
0
    print("Table '%s' already exists in database '%s'." %
          (options.target_table, options.target_database))
    if not options.append:
        while True:
            value = raw_input("Do you want to remove table '%s' (y/n)?: " %
                              options.target_table).lower()
            if value == 'n':
                print("Append data to table '%s'." % options.target_table)
                break
            elif value == 'y':
                bfmap.remove(options.target_host, options.target_port,
                             options.target_database, options.target_table,
                             options.target_user, target_password,
                             options.printonly)
                print("Table '%s' has been removed." % options.target_table)
                bfmap.schema(options.target_host, options.target_port,
                             options.target_database, options.target_table,
                             options.target_user, target_password,
                             options.printonly)
                print("Table '%s' has been recreated." % options.target_table)
                break

print("Inserting data ...")
bfmap.ways2bfmap(options.source_host, options.source_port,
                 options.source_database, options.source_table,
                 options.source_user, source_password, options.target_host,
                 options.target_port, options.target_database,
                 options.target_table, options.target_user, target_password,
                 config, options.printonly)
print("Done.")