예제 #1
0
    if args.city not in ymlconf_cities:
        print((
            "ERROR: '{0}' city not defined in configuration file '{1}'".format(
                args.city, args.cfg)))
        sys.exit()

    # get city configuration
    cityconf = ymlconf_cities[args.city]

    # check if the configuration is well defined for the city
    if (("tablename" not in cityconf) or ("extent" not in cityconf)
            or ("maxtilesize" not in cityconf)):
        print(("ERROR: '{0}' city is not properly defined in '{1}'".format(
            args.city, args.cfg)))
        sys.exit()

    # open database
    app = type('', (), {})()
    app.config = ymlconf_db
    Session.init_app(app)
    utils.CitiesConfig.init(str(args.cfg))

    # reinitialize the database
    tablename = cityconf['tablename']
    Session.drop_column(tablename, "quadtile")
    Session.drop_column(tablename, "weight")
    Session.drop_bbox_table(tablename)

    # fill the database
    initDB(args.city, cityconf, args.score)
    # check if the city is within the configuration
    if args.city not in ymlconf_cities:
        print(("ERROR: '{0}' city not defined in configuration file '{1}'"
               .format(args.city, args.cfg)))
        sys.exit()

    # get city configuration
    cityconf = ymlconf_cities[args.city]

    # check if the configuration is well defined for the city
    if (("tablename" not in cityconf) or ("extent" not in cityconf)
            or ("maxtilesize" not in cityconf)):
        print(("ERROR: '{0}' city is not properly defined in '{1}'"
              .format(args.city, args.cfg)))
        sys.exit()

    # open database
    app = type('', (), {})()
    app.config = ymlconf_db
    Session.init_app(app)
    utils.CitiesConfig.init(str(args.cfg))

    # reinitialize the database
    tablename = cityconf['tablename']
    Session.drop_column(tablename, "quadtile")
    Session.drop_column(tablename, "weight")
    Session.drop_bbox_table(tablename)

    # fill the database
    initDB(args.city, cityconf, args.score)
    # check if the city is within the configuration
    if args.city not in ymlconf_cities:
        print(("ERROR: '{0}' city not defined in configuration file '{1}'"
               .format(args.city, args.cfg)))
        sys.exit()

    # get city configuration
    cityconf = ymlconf_cities[args.city]

    # check if the configuration is well defined for the city
    if (("tablename" not in cityconf) or ("extent" not in cityconf)
            or ("maxtilesize" not in cityconf)):
        print(("ERROR: '{0}' city is not properly defined in '{1}'"
              .format(args.city, args.cfg)))
        sys.exit()

    # open database
    app = type('', (), {})()
    app.config = ymlconf_db
    Session.init_app(app)
    utils.CitiesConfig.init(str(args.cfg))

    # reinitialize the database
    Session.drop_column(args.city, "quadtile")
    Session.drop_column(args.city, "weight")
    Session.drop_bbox_table(args.city)

    # fill the database
    initDB(args.city, cityconf, args.score)