Ejemplo n.º 1
0
def _init_and_clear_database():
    # creates database if necessary
    init_database()

    exec_sql("DROP OWNED BY osm_test")

    # prepare schema for tests
    current_directory = os.path.dirname(os.path.realpath(__file__))
    exec_sql_from_file('helpers/schema.sql.dump', cwd=current_directory)
    exec_sql_from_file('helpers/functions.sql', cwd=current_directory)
    export_osmnames.create_functions()

    # necessary for export tests
    if not os.path.exists('/tmp/osmnames/export/'):
        os.makedirs('/tmp/osmnames/export/')
Ejemplo n.º 2
0
def import_country_osm_grid():
    exec_sql_from_file("country_osm_grid.sql", cwd="{}/sql/".format(settings.get("DATA_DIR")))
Ejemplo n.º 3
0
def set_street_attributes_by_nearest_street():
    exec_sql_from_file("set_street_attributes_by_nearest_street.sql", cwd=SQL_DIR)
Ejemplo n.º 4
0
def schema(engine):
    current_directory = os.path.dirname(os.path.realpath(__file__))
    exec_sql_from_file('fixtures/test_prepare_imported_data.sql.dump',
                       cwd=current_directory)
Ejemplo n.º 5
0
def merge_corresponding_linestrings():
    exec_sql_from_file("merge_corresponding_linestrings.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Ejemplo n.º 6
0
def set_country_codes():
    exec_sql_from_file("set_country_codes.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
    consistency_check.missing_country_codes()
Ejemplo n.º 7
0
def create_custom_columns():
    exec_sql_from_file("create_custom_columns.sql", cwd=os.path.dirname(__file__))
Ejemplo n.º 8
0
def merge_linked_nodes():
    exec_sql_from_file("merge_linked_nodes/merge_nodes_linked_by_relation.sql",
                       cwd=os.path.dirname(__file__))
    vacuum_database()
Ejemplo n.º 9
0
def set_parent_ids():
    exec_sql_from_file("set_parent_ids.sql", cwd=SQL_DIR)
    vacuum_database()
Ejemplo n.º 10
0
def cluster_geometries():
    exec_sql_from_file("cluster_geometries.sql", cwd=SQL_DIR)
    vacuum_database()
Ejemplo n.º 11
0
def set_geometry_centers():
    exec_sql_from_file("set_geometry_centers.sql", cwd=SQL_DIR)
    vacuum_database()
Ejemplo n.º 12
0
def create_geonames_view():
    exec_sql_from_file("create_geonames_view.sql", cwd=os.path.dirname(__file__))
Ejemplo n.º 13
0
def create_housenumbers_view():
    exec_sql_from_file("create_housenumbers_view.sql", cwd=os.path.dirname(__file__))
Ejemplo n.º 14
0
def create_merged_linestrings_view():
    exec_sql_from_file("create_merged_linestrings_view.sql", cwd=os.path.dirname(__file__))
Ejemplo n.º 15
0
def set_names_from_tags():
    exec_sql_from_file("set_names_from_tags.sql", cwd=SQL_DIR)
Ejemplo n.º 16
0
def set_tables_unlogged():
    exec_sql_from_file("set_tables_unlogged.sql",
                       cwd=os.path.dirname(__file__),
                       parallelize=True)
Ejemplo n.º 17
0
def set_geometry_centers():
    exec_sql_from_file("set_geometry_centers.sql", cwd=SQL_DIR)
    vacuum_database()
Ejemplo n.º 18
0
def set_polygon_types():
    exec_sql_from_file("set_polygon_types.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Ejemplo n.º 19
0
def cluster_geometries():
    exec_sql_from_file("cluster_geometries.sql", cwd=SQL_DIR)
    vacuum_database()
Ejemplo n.º 20
0
def delete_unusable_entries():
    exec_sql_from_file("delete_unusable_entries.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Ejemplo n.º 21
0
def set_parent_ids():
    exec_sql_from_file("set_parent_ids.sql", cwd=SQL_DIR)
    vacuum_database()
Ejemplo n.º 22
0
def set_place_parentInfo():
    exec_sql_from_file("set_place_parentInfo.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Ejemplo n.º 23
0
def create_custom_columns():
    exec_sql_from_file("create_custom_columns.sql", cwd=os.path.dirname(__file__))
Ejemplo n.º 24
0
def create_custom_types():
    exec_sql_from_file("create_custom_types.sql",
                       cwd=os.path.dirname(__file__),
                       user="******")
Ejemplo n.º 25
0
def set_linestring_centers():
    exec_sql_from_file("set_linestring_centers.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Ejemplo n.º 26
0
def create_functions():
    exec_sql_from_file("functions.sql", cwd=os.path.dirname(__file__))
Ejemplo n.º 27
0
def delete_unusable_entries():
    exec_sql_from_file("delete_unusable_entries.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Ejemplo n.º 28
0
def sanitize_housenumbers():
    exec_sql_from_file("sanitize_housenumbers.sql", cwd=SQL_DIR)
Ejemplo n.º 29
0
def set_place_ranks():
    exec_sql_from_file("set_place_ranks.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Ejemplo n.º 30
0
def set_country_codes():
    exec_sql_from_file("set_country_codes.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
    consistency_check.missing_country_codes()
Ejemplo n.º 31
0
def determine_linked_places():
    exec_sql_from_file("determine_linked_places.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Ejemplo n.º 32
0
def set_linestring_names_from_relations():
    exec_sql_from_file("set_linestring_names_from_relations.sql", cwd=SQL_DIR)
Ejemplo n.º 33
0
def merge_corresponding_linestrings():
    exec_sql_from_file("merge_corresponding_linestrings.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Ejemplo n.º 34
0
def create_helper_functions():
    exec_sql_from_file("create_helper_functions.sql",
                       cwd=os.path.dirname(__file__),
                       parallelize=True)
Ejemplo n.º 35
0
def create_functions():
    exec_sql_from_file("functions.sql", cwd=os.path.dirname(__file__))
Ejemplo n.º 36
0
def delete_nameless_entries():
    exec_sql_from_file("delete_nameless_entries.sql",
                       cwd=os.path.dirname(__file__),
                       parallelize=True)
    vacuum_database()
Ejemplo n.º 37
0
def create_merged_linestrings_view():
    exec_sql_from_file("create_merged_linestrings_view.sql",
                       cwd=os.path.dirname(__file__))
Ejemplo n.º 38
0
def follow_wikipedia_redirects():
    exec_sql_from_file("follow_wikipedia_redirects.sql",
                       cwd=os.path.dirname(__file__))
    vacuum_database()
Ejemplo n.º 39
0
def create_housenumbers_view():
    exec_sql_from_file("create_housenumbers_view.sql",
                       cwd=os.path.dirname(__file__))
Ejemplo n.º 40
0
def set_linestring_centers():
    exec_sql_from_file("set_linestring_centers.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Ejemplo n.º 41
0
def create_geonames_view():
    exec_sql_from_file("create_geonames_view.sql",
                       cwd=os.path.dirname(__file__))
Ejemplo n.º 42
0
def set_place_ranks():
    exec_sql_from_file("set_place_ranks.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Ejemplo n.º 43
0
def merge_nodes_linked_by_relation():
    exec_sql_from_file("merge_nodes_linked_by_relation.sql", cwd=SQL_DIR)
    vacuum_database()
Ejemplo n.º 44
0
def determine_linked_places():
    exec_sql_from_file("determine_linked_places.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Ejemplo n.º 45
0
def set_street_attributes_by_street_relation_members():
    exec_sql_from_file("set_street_attributes_by_street_relation_members.sql", cwd=SQL_DIR)
Ejemplo n.º 46
0
def add_missing_streetnames_postcodes_cities():
    exec_sql_from_file("add_missing_streetnames_postcodes_cities.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Ejemplo n.º 47
0
def set_street_names_by_relation_attributes():
    exec_sql_from_file("set_street_names_by_relation_attributes.sql", cwd=SQL_DIR)
Ejemplo n.º 48
0
def remove_duplicate_entries():
    exec_sql_from_file("remove_duplicate_entries.sql", cwd=os.path.dirname(__file__))
    vacuum_database()
Ejemplo n.º 49
0
def normalize_street_names():
    exec_sql_from_file("normalize_street_names.sql", cwd=SQL_DIR)
Ejemplo n.º 50
0
def schema(engine):
    current_directory = os.path.dirname(os.path.realpath(__file__))
    exec_sql_from_file('fixtures/test_export_osmnames.sql.dump', cwd=current_directory)
    create_functions()
Ejemplo n.º 51
0
def set_street_ids_by_street_name():
    exec_sql_from_file("set_street_ids_by_street_name.sql", cwd=SQL_DIR)
Ejemplo n.º 52
0
def import_country_osm_grid():
    exec_sql_from_file("country_osm_grid.sql",
                       cwd="{}/sql/".format(settings.get("DATA_DIR")))
Ejemplo n.º 53
0
def create_custom_types():
    exec_sql_from_file("create_custom_types.sql", cwd=os.path.dirname(__file__), user="******")