[osm2pgrouting] 01/04: New upstream version 2.3.2

Bas Couwenberg sebastic at debian.org
Wed Oct 18 05:47:55 UTC 2017


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository osm2pgrouting.

commit 0fad96100d5b4bd0b4542141a62fd98adb80ff35
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Wed Oct 18 07:20:38 2017 +0200

    New upstream version 2.3.2
---
 NEWS                                  | 8 +++++++-
 include/utilities/print_progress.h    | 2 +-
 src/database/Export2DB.cpp            | 2 ++
 src/database/osm_nodes_config.cpp     | 4 ++--
 src/database/osm_relations_config.cpp | 4 ++--
 src/database/osm_ways_config.cpp      | 8 ++++----
 src/osm_elements/osm2pgrouting.cpp    | 8 +++++++-
 src/utilities/prog_options.cpp        | 6 +++++-
 8 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/NEWS b/NEWS
index 710a956..9fbe749 100644
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,10 @@
-osm2pgRouting 2.3.0
+osm2pgRouting 2.3.2
+
+* Fix: Only on linux: use the wc command to count lines
+* Fix: the `osm_<tables>` are created only when addnodes flag is on
+* Fix: removed unused flag of the command line
+
+osm2pgRouting 2.3.1
 
 * Fix: When keys have spaces
 * Fix: Generating relations
diff --git a/include/utilities/print_progress.h b/include/utilities/print_progress.h
index ecf66ea..5257d09 100644
--- a/include/utilities/print_progress.h
+++ b/include/utilities/print_progress.h
@@ -47,6 +47,6 @@ print_progress(T1 wantProgress, T2 currentProgress) {
     std::cout << "\r"
         << bar
         << " (" << static_cast<int>(100 * percent) << "%)"
-        << " Total porcessed: " << currentProgress << std::flush;
+        << " Total processed: " << currentProgress << std::flush;
 }
 #endif  // SRC_PRINT_PROGRESS_H_
diff --git a/src/database/Export2DB.cpp b/src/database/Export2DB.cpp
index e9ad856..8413d5b 100644
--- a/src/database/Export2DB.cpp
+++ b/src/database/Export2DB.cpp
@@ -135,6 +135,7 @@ void Export2DB::createTables() const {
         exit(1);
     }
 
+    if (m_vm.count("addnodes")) {
     try {
         pqxx::connection db_conn(conninf);
         pqxx::work Xaction(db_conn);
@@ -156,6 +157,7 @@ void Export2DB::createTables() const {
         std::cerr <<  "WARNING: could not create osm-*  tables" << std::endl;
         std::cerr <<  "   Insertions on osm_* tables are going to be ignored" << std::endl;
     }
+    }
 }
 
 
diff --git a/src/database/osm_nodes_config.cpp b/src/database/osm_nodes_config.cpp
index d02a62b..3ee053d 100644
--- a/src/database/osm_nodes_config.cpp
+++ b/src/database/osm_nodes_config.cpp
@@ -44,10 +44,10 @@ Tables::osm_nodes_config() const {
             /* standard column creation string */
             std::string(
                 " osm_id bigint PRIMARY KEY"
-                + (m_vm.count("attributes") ?
+                + (m_vm.count("attributes") && m_vm.count("addnodes") ?
                     (std::string(", attributes hstore"))
                     : "")
-                + (m_vm.count("tags") ?
+                + (m_vm.count("tags")  && m_vm.count("addnodes") ?
                     (std::string(", tags hstore"))
 #if 0
                     (std::string(", tags ") + (m_vm.count("hstore") ? "hstore" : "json"))
diff --git a/src/database/osm_relations_config.cpp b/src/database/osm_relations_config.cpp
index 0e82378..ff2dafd 100644
--- a/src/database/osm_relations_config.cpp
+++ b/src/database/osm_relations_config.cpp
@@ -45,10 +45,10 @@ Tables::osm_relations_config() const {
             std::string(
                 " osm_id bigint PRIMARY KEY"
                 " , members hstore"
-                + (m_vm.count("attributes") ?
+                + (m_vm.count("attributes")  && m_vm.count("addnodes") ?
                     (std::string(", attributes hstore"))
                     : "")
-                + (m_vm.count("tags") ?
+                + (m_vm.count("tags")  && m_vm.count("addnodes")?
                     (std::string(", tags hstore"))
                     : "")
                 ),
diff --git a/src/database/osm_ways_config.cpp b/src/database/osm_ways_config.cpp
index b52e742..7140876 100644
--- a/src/database/osm_ways_config.cpp
+++ b/src/database/osm_ways_config.cpp
@@ -44,11 +44,11 @@ Tables::osm_ways_config() const {
             /* standard column creation string */
             std::string(
                 " osm_id bigint PRIMARY KEY"
-                " , members hstore"
-                + (m_vm.count("attributes") ?
-                    (std::string(", attributes hstore"))
+                //" , members hstore"
+                + (m_vm.count("attributes")  && m_vm.count("addnodes") ?
+                    (std::string(", attributes hstore")) 
                     : "")
-                + (m_vm.count("tags") ?
+                + (m_vm.count("tags")  && m_vm.count("addnodes") ?
                     (std::string(", tags hstore"))
 #if 0
                     (std::string(", tags ") + (m_vm.count("hstore") ? "hstore" : "json"))
diff --git a/src/osm_elements/osm2pgrouting.cpp b/src/osm_elements/osm2pgrouting.cpp
index 0574246..4b9218f 100644
--- a/src/osm_elements/osm2pgrouting.cpp
+++ b/src/osm_elements/osm2pgrouting.cpp
@@ -41,6 +41,7 @@
 #include "utilities/handle_pgpass.h"
 #include "utilities/prog_options.h"
 
+#if defined(__linux__)
 static
 size_t lines_in_file(const std::string file_name) {
     FILE *in;
@@ -67,6 +68,7 @@ size_t lines_in_file(const std::string file_name) {
         exit(1);
     }
 }
+#endif
 
 
 int main(int argc, char* argv[]) {
@@ -161,7 +163,7 @@ int main(int argc, char* argv[]) {
             std::cout << "   HINT: CREATE EXTENSION postGIS\n";
             return 1;
         }
-        if ((vm.count("attributes") || vm.count("tags"))
+        if ((vm.count("attributes") || vm.count("tags") || vm.count("addnodes"))
                 && !dbConnection.has_extension("hstore")) {
             std::cout << "ERROR: hstore not found\n";
             std::cout << "   HINT: CREATE EXTENSION hstore\n";
@@ -201,6 +203,7 @@ int main(int argc, char* argv[]) {
         std::cout << "  - Done \n";
 
 
+#if defined(__linux__)
         std::cout << "Counting lines ...\n";
         auto total_lines = lines_in_file(dataFile);
         std::cout << "  - Done \n";
@@ -210,6 +213,9 @@ int main(int argc, char* argv[]) {
             << "\ttotal lines: "
             << total_lines
             << endl;
+#else
+        size_t total_lines = 0;
+#endif
         osm2pgr::OSMDocument document(config, vm, dbConnection, total_lines);
         osm2pgr::OSMDocumentParserCallback callback(document);
 
diff --git a/src/utilities/prog_options.cpp b/src/utilities/prog_options.cpp
index 79446f7..d99ddd1 100644
--- a/src/utilities/prog_options.cpp
+++ b/src/utilities/prog_options.cpp
@@ -51,7 +51,9 @@ void get_option_description(po::options_description &od_desc) {
         ("schema", po::value<std::string>()->default_value(""), "Database schema to put tables.\n  blank:\t defaults to default schema dictated by PostgreSQL search_path.")
         ("prefix", po::value<std::string>()->default_value(""), "Prefix added at the beginning of the table names.")
         ("suffix", po::value<std::string>()->default_value(""), "Suffix added at the end of the table names.")
+#if 0
         ("postgis", "Install postgis if not found.")  // TODO(vicky) remove before realesing
+#endif
         ("addnodes", "Import the osm_nodes, osm_ways & osm_relations tables.")
         ("attributes", "Include attributes information.")
         ("tags", "Include tag information.")
@@ -100,13 +102,15 @@ process_command_line(po::variables_map &vm) {
     std::cout << "schema= " << vm["schema"].as<std::string>() << "\n";
     std::cout << "prefix = " << vm["prefix"].as<std::string>() << "\n";
     std::cout << "suffix = " << vm["suffix"].as<std::string>() << "\n";
+#if 0
     std::cout << (vm.count("postgis")? "I" : "Don't I") << "nstall postgis if not found\n";
+#endif
     std::cout << (vm.count("clean")? "D" : "Don't d") << "rop tables\n";
     std::cout << (vm.count("no-index")? "D" : "Don't c") << "reate indexes\n";
     std::cout << (vm.count("addnodes")? "A" : "Don't a") << "dd OSM nodes\n";
+#if 0
     std::cout << (vm.count("addways")? "A" : "Don't a") << "dd OSM ways\n";
     std::cout << (vm.count("addrelations")? "A" : "Don't a") << "dd OSM relations\n";
-#if 0
     std::cout << (vm.count("fork")? "F" : "Don't f") << "ork\n";
 #endif
     std::cout << "***************************************************\n";

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osm2pgrouting.git



More information about the Pkg-grass-devel mailing list