diff --git a/AUTHORS.md b/AUTHORS.md index 790d31f0..5edfb794 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -14,4 +14,5 @@ * Daniel Wendt (Initial author) * Jordan Anderson * J Kishore Kumar +* Luís de Sousa * Sarthak Agarwal diff --git a/NEWS b/NEWS index 8e54852f..56072f47 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,7 @@ osm2pgRouting 2.2.0 * New mapconfig_for_bicycles.xml * Improved the C++ code. * remove the use of pointers to avoid leaks. +* Table `osm_ways_tags` because information is redundant. diff --git a/mapconfig_for_pedestrian.xml b/mapconfig_for_pedestrian.xml deleted file mode 100644 index 92821999..00000000 --- a/mapconfig_for_pedestrian.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Export2DB.cpp b/src/Export2DB.cpp index 9605f65f..e2d6e995 100644 --- a/src/Export2DB.cpp +++ b/src/Export2DB.cpp @@ -425,12 +425,6 @@ void Export2DB::fill_vertices_table(const std::string &table, const std::string PGresult* q_result = PQexec(mycon, sql.c_str()); std::cout << "Vertices inserted " << PQcmdTuples(q_result); -#if 0 - if (PQresultStatus(q_result) == PGRES_COMMAND_OK) - std::cout << " OK " << PQcmdStatus(q_result) << std::endl; - else - std::cout << " " << PQresultErrorMessage(q_result) << std::endl; -#endif PQclear(q_result); } @@ -903,12 +897,6 @@ void Export2DB::createFKeys() { auto vertices_name = ways_name + "_vertices_pgr"; - // return; // TODO - /* - ALTER TABLE osm_way_classes - ADD FOREIGN KEY (type_id) REFERENCES osm_way_types (type_id) ON UPDATE NO ACTION ON DELETE NO ACTION; - */ - std::string fk_classes( "ALTER TABLE " + addSchema("osm_way_classes") + " ADD FOREIGN KEY (type_id) REFERENCES " + addSchema("osm_way_types") + "(type_id)"); PGresult *result = PQexec(mycon, fk_classes.c_str()); @@ -922,30 +910,10 @@ void Export2DB::createFKeys() { std::cout << "Foreign keys for " + addSchema("osm_way_classes") + " table created" << std::endl; } -#if 0 - std::string fk_way_tag( - "ALTER TABLE " + addSchema("osm_way_tags") + " ADD FOREIGN KEY (class_id) REFERENCES " + addSchema("osm_way_classes") + "(class_id); " + - "ALTER TABLE " + addSchema("osm_way_tags") + " ADD FOREIGN KEY (way_id) REFERENCES " + addSchema(ways_name) + "(gid); "); - result = PQexec(mycon, fk_way_tag.c_str()); - if (PQresultStatus(result) != PGRES_COMMAND_OK) { - std::cerr << PQresultStatus(result); - std::cerr << "foreign keys for " + addSchema("osm_way_tags") + " failed: " - << PQerrorMessage(mycon) - << std::endl; - PQclear(result); - } else { - std::cout << "Foreign keys for " + addSchema("osm_way_tags") + " table created" << std::endl; - } -#endif std::string fk_relations( "ALTER TABLE " + addSchema(full_table_name("relations_ways")) + " ADD FOREIGN KEY (relation_id) REFERENCES " + addSchema("osm_relations") + "(relation_id); "); result = PQexec(mycon, fk_relations.c_str()); -#if 0 - // its not working as there are several ways with the same osm_id - // the gid is not possible because that is "on the fly" sequential - "ALTER TABLE " + addSchema(full_table_name("relations_ways")) + " ADD FOREIGN KEY (way_id) REFERENCES " + addSchema(full_table_name("ways")) + "(osm_id);"); -#endif if (PQresultStatus(result) != PGRES_COMMAND_OK) { std::cerr << PQresultStatus(result); std::cerr << "foreign keys for " + addSchema(full_table_name("relations_ways")) + " failed: " diff --git a/src/osm2pgrouting.cpp b/src/osm2pgrouting.cpp index 2e7f8b08..ecbbd224 100644 --- a/src/osm2pgrouting.cpp +++ b/src/osm2pgrouting.cpp @@ -38,29 +38,6 @@ #include "./Export2DB.h" #include "./prog_options.h" -#if 0 -static -size_t lines_in_file(const std::string file_name) { - FILE *in; - char buff[512]; - std::string command = "wc -l " + file_name; - - if (!(in = popen(command.c_str(), "r"))) { - exit(1); - } - - std::string word; - if (fgets(buff, 512, in) != NULL) { - word = buff; - } - pclose(in); - std::istringstream iss(word); - std::string number; - iss >> number; - - return boost::lexical_cast(number); -} -#endif int main(int argc, char* argv[]) { #ifdef WITH_TIME @@ -74,9 +51,7 @@ int main(int argc, char* argv[]) { std::chrono::steady_clock::time_point begin_elapsed = std::chrono::steady_clock::now(); #endif -#if 1 try { -#endif po::options_description od_desc("Allowed options"); get_option_description(od_desc); @@ -141,15 +116,7 @@ int main(int argc, char* argv[]) { } size_t total_lines = 100000; -#if 0 - auto total_lines = lines_in_file(dataFile); - - std::cout << "Opening data file: " - << dataFile - << " total lines " - << total_lines - << endl; -#endif + osm2pgr::OSMDocument document(config, total_lines); osm2pgr::OSMDocumentParserCallback callback(document); @@ -187,10 +154,6 @@ int main(int argc, char* argv[]) { dbConnection.exportRelations(document.relations(), config); std::cout << "\nExport RelationsWays ..." << endl; dbConnection.exportRelationsWays(document.relations(), config); -#if 0 - std::cout << "\nexport Tags ..." << endl; - dbConnection.exportTags(document.m_SplitWays, config); -#endif std::cout << "\nExport Ways ..." << endl; dbConnection.exportWays(document.ways(), config); @@ -228,7 +191,6 @@ int main(int argc, char* argv[]) { std::cout << "#########################" << endl; return 0; -#if 1 } catch (exception &e) { std::cout << e.what() << endl; @@ -242,5 +204,4 @@ int main(int argc, char* argv[]) { std::cout << "Terminating" << endl; return 1; } -#endif } diff --git a/tools/spelling/fix_typos.sh b/tools/spelling/fix_typos.sh index 197eefc5..3c4dbc86 100755 --- a/tools/spelling/fix_typos.sh +++ b/tools/spelling/fix_typos.sh @@ -62,6 +62,6 @@ EXCLUDED_FILES="$EXCLUDED_FILES,*/tools/*" #WORDS_WHITE_LIST="$WORDS_WHITE_LIST,THRESHHOLD_BILEVEL,THRESHHOLD_HALFTONE,THRESHHOLD_ERRORDIFFUSE" python3 fix_typos/codespell/codespell.py -w -i 3 -q 2 -S $EXCLUDED_FILES \ - -x tools/scripts/typos_whitelist.txt --words-white-list=$WORDS_WHITE_LIST \ + -x tools/spelling/typos_whitelist.txt --words-white-list=$WORDS_WHITE_LIST \ -D fix_typos/gdal_dict.txt .