Skip to content

Commit

Permalink
Merge pull request #190 from cvvergara/fix-issue189
Browse files Browse the repository at this point in the history
Fix issue189
  • Loading branch information
cvvergara authored Oct 15, 2017
2 parents 8c27bb0 + 15831e4 commit 8def279
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 19 deletions.
5 changes: 5 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
osm2pgRouting 2.3.0

* Fix: When keys have spaces
* Fix: Generating relations

osm2pgRouting 2.3.0

* Cost should not return the same value
* Added a points of Interest table
* Some default one_way values are taken into consideration
Expand Down
2 changes: 1 addition & 1 deletion src/database/Export2DB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ void Export2DB::process_pois() const {
execute(pois().sql(4));

std::cout << "\nTo process pointsOfInterest table:"
"\nosm2pgr_pois_update(radius deault 200, within default 50)\n"
"\nosm2pgr_pois_update(radius default 200, within default 50)\n"
"\n - Using areas of (radius)mts on POIS"
"\n - Using edges that are at least (within) mts of each POI"
"\nPOIS that do not have a closest edge is considered as too far\n";
Expand Down
19 changes: 9 additions & 10 deletions src/osm_elements/OSMDocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,15 @@ void OSMDocument::AddWay(const Way &w) {
if (m_ways.empty() && m_vm.count("addnodes")) {
wait_child();
osm_table_export(m_nodes, "osm_nodes");
std::cout << "\nFinal osm_nodes:\t" << m_nodes.size();
export_pois();
std::cout << "\nFinal osm_nodes:\t" << m_nodes.size() << "\n";
}


if (m_vm.count("addnodes")) {
if ((m_ways.size() % m_chunk_size) == 0) {
wait_child();
if (m_ways.size() % 200000 == 0) {
std::cout << "\nCurrent osm_ways:\t" << m_ways.size();
}
std::cout << "\rCurrent osm_ways:\t" << m_ways.size();
osm_table_export(m_ways, "osm_ways");
}
}
Expand All @@ -115,15 +113,15 @@ OSMDocument::AddRelation(const Relation &r) {
if (m_vm.count("addnodes") && m_relations.empty()) {
wait_child();
osm_table_export(m_ways, "osm_ways");
std::cout << "\nFinal osm_ways:\t" << m_ways.size();
std::cout << "\nFinal osm_ways:\t" << m_ways.size() << "\n";
}

if (m_vm.count("addnodes")) {
wait_child();
if (m_relations.size() % 100000 == 0) {
std::cout << "\nCurrent osm_relations:\t" << m_relations.size();
if (m_relations.size() % m_chunk_size == 0) {
wait_child();
std::cout << "\rCurrent osm_relations:\t" << m_relations.size();
osm_table_export(m_relations, "osm_relations");
}
osm_table_export(m_relations, "osm_relations");
}
m_relations.push_back(r);
}
Expand All @@ -132,9 +130,10 @@ void
OSMDocument::endOfFile() const {
if (m_vm.count("addnodes")) {
wait_child();
std::cout << "\nFinal osm_relations:\t" << m_relations.size();
osm_table_export(m_relations, "osm_relations");
std::cout << "\nEnd Of file\n\n\n";
}
std::cout << "\nEnd Of file\n\n\n";
}


Expand Down
2 changes: 1 addition & 1 deletion src/osm_elements/osm2pgrouting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ int main(int argc, char* argv[]) {
}

if (vm.count("version")) {
std::cout << "This is osm2pgrouting Version 2.3\n";
std::cout << "This is osm2pgrouting Version 2.3.1\n";
return 0;
}

Expand Down
3 changes: 2 additions & 1 deletion src/osm_elements/osm_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ getHstore(const std::map<std::string, std::string> &values) {
if (values.empty()) return std::string();

for (const auto item : values) {
hstore += item.first
hstore +=
addquotes(item.first, true)
+ " => "
+ addquotes(item.second, true) + ",";
}
Expand Down
14 changes: 8 additions & 6 deletions src/parser/OSMDocumentParserCallback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ namespace osm2pgr {

void
OSMDocumentParserCallback::show_progress() {
#if 0
try {
if (m_line == 0) return;
assert(m_rDocument.lines());
Expand All @@ -66,6 +67,7 @@ OSMDocumentParserCallback::show_progress() {
} catch(...) {
m_line = 1;
}
#endif
}


Expand Down Expand Up @@ -141,12 +143,14 @@ OSMDocumentParserCallback::StartElement(
auto tag = last_relation->add_tag(Tag(atts));
m_rDocument.add_config(last_relation, tag);
}
} else if (strcmp(name, "osm") == 0) {
}
if (strcmp(name, "osm") == 0) {
}
}

void OSMDocumentParserCallback::EndElement(const char* name) {
if (strcmp(name, "osm") == 0) {
m_rDocument.endOfFile();
return;
}
if (strcmp(name, "node") == 0) {
Expand All @@ -169,7 +173,8 @@ void OSMDocumentParserCallback::EndElement(const char* name) {
delete last_way;
return;

} else if (strcmp(name, "relation") == 0) {
}
if (strcmp(name, "relation") == 0) {
if (m_rDocument.config_has_tag(last_relation->tag_config())) {
for (auto it = last_relation->way_refs().begin(); it != last_relation->way_refs().end(); ++it) {
auto way_id = *it;
Expand All @@ -187,13 +192,10 @@ void OSMDocumentParserCallback::EndElement(const char* name) {
}
}
}
m_rDocument.AddRelation(*last_relation);
}
m_rDocument.AddRelation(*last_relation);
delete last_relation;

} else if (strcmp(name, "osm") == 0) {
m_rDocument.endOfFile();
show_progress();
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/utilities/handle_pgpass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ handle_pgpass(po::variables_map &vm) {
&& (user == "*" || user == username)
&& (dbase == "*" || host == vm["dbname"].as<std::string>())) {
infile.close();
#if 0
std::cout << passwd << "\n";
#endif
vm.at("password").value() = passwd;
return;
}
Expand Down

0 comments on commit 8def279

Please sign in to comment.