Skip to content

Commit 8def279

Browse files
authored
Merge pull request #190 from cvvergara/fix-issue189
Fix issue189
2 parents 8c27bb0 + 15831e4 commit 8def279

File tree

7 files changed

+28
-19
lines changed

7 files changed

+28
-19
lines changed

NEWS

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
osm2pgRouting 2.3.0
22

3+
* Fix: When keys have spaces
4+
* Fix: Generating relations
5+
6+
osm2pgRouting 2.3.0
7+
38
* Cost should not return the same value
49
* Added a points of Interest table
510
* Some default one_way values are taken into consideration

src/database/Export2DB.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -598,7 +598,7 @@ void Export2DB::process_pois() const {
598598
execute(pois().sql(4));
599599

600600
std::cout << "\nTo process pointsOfInterest table:"
601-
"\nosm2pgr_pois_update(radius deault 200, within default 50)\n"
601+
"\nosm2pgr_pois_update(radius default 200, within default 50)\n"
602602
"\n - Using areas of (radius)mts on POIS"
603603
"\n - Using edges that are at least (within) mts of each POI"
604604
"\nPOIS that do not have a closest edge is considered as too far\n";

src/osm_elements/OSMDocument.cpp

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,15 @@ void OSMDocument::AddWay(const Way &w) {
9292
if (m_ways.empty() && m_vm.count("addnodes")) {
9393
wait_child();
9494
osm_table_export(m_nodes, "osm_nodes");
95-
std::cout << "\nFinal osm_nodes:\t" << m_nodes.size();
9695
export_pois();
96+
std::cout << "\nFinal osm_nodes:\t" << m_nodes.size() << "\n";
9797
}
9898

9999

100100
if (m_vm.count("addnodes")) {
101101
if ((m_ways.size() % m_chunk_size) == 0) {
102102
wait_child();
103-
if (m_ways.size() % 200000 == 0) {
104-
std::cout << "\nCurrent osm_ways:\t" << m_ways.size();
105-
}
103+
std::cout << "\rCurrent osm_ways:\t" << m_ways.size();
106104
osm_table_export(m_ways, "osm_ways");
107105
}
108106
}
@@ -115,15 +113,15 @@ OSMDocument::AddRelation(const Relation &r) {
115113
if (m_vm.count("addnodes") && m_relations.empty()) {
116114
wait_child();
117115
osm_table_export(m_ways, "osm_ways");
118-
std::cout << "\nFinal osm_ways:\t" << m_ways.size();
116+
std::cout << "\nFinal osm_ways:\t" << m_ways.size() << "\n";
119117
}
120118

121119
if (m_vm.count("addnodes")) {
122-
wait_child();
123-
if (m_relations.size() % 100000 == 0) {
124-
std::cout << "\nCurrent osm_relations:\t" << m_relations.size();
120+
if (m_relations.size() % m_chunk_size == 0) {
121+
wait_child();
122+
std::cout << "\rCurrent osm_relations:\t" << m_relations.size();
123+
osm_table_export(m_relations, "osm_relations");
125124
}
126-
osm_table_export(m_relations, "osm_relations");
127125
}
128126
m_relations.push_back(r);
129127
}
@@ -132,9 +130,10 @@ void
132130
OSMDocument::endOfFile() const {
133131
if (m_vm.count("addnodes")) {
134132
wait_child();
133+
std::cout << "\nFinal osm_relations:\t" << m_relations.size();
135134
osm_table_export(m_relations, "osm_relations");
136-
std::cout << "\nEnd Of file\n\n\n";
137135
}
136+
std::cout << "\nEnd Of file\n\n\n";
138137
}
139138

140139

src/osm_elements/osm2pgrouting.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ int main(int argc, char* argv[]) {
9696
}
9797

9898
if (vm.count("version")) {
99-
std::cout << "This is osm2pgrouting Version 2.3\n";
99+
std::cout << "This is osm2pgrouting Version 2.3.1\n";
100100
return 0;
101101
}
102102

src/osm_elements/osm_element.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,8 @@ getHstore(const std::map<std::string, std::string> &values) {
155155
if (values.empty()) return std::string();
156156

157157
for (const auto item : values) {
158-
hstore += item.first
158+
hstore +=
159+
addquotes(item.first, true)
159160
+ " => "
160161
+ addquotes(item.second, true) + ",";
161162
}

src/parser/OSMDocumentParserCallback.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ namespace osm2pgr {
5656

5757
void
5858
OSMDocumentParserCallback::show_progress() {
59+
#if 0
5960
try {
6061
if (m_line == 0) return;
6162
assert(m_rDocument.lines());
@@ -66,6 +67,7 @@ OSMDocumentParserCallback::show_progress() {
6667
} catch(...) {
6768
m_line = 1;
6869
}
70+
#endif
6971
}
7072

7173

@@ -141,12 +143,14 @@ OSMDocumentParserCallback::StartElement(
141143
auto tag = last_relation->add_tag(Tag(atts));
142144
m_rDocument.add_config(last_relation, tag);
143145
}
144-
} else if (strcmp(name, "osm") == 0) {
146+
}
147+
if (strcmp(name, "osm") == 0) {
145148
}
146149
}
147150

148151
void OSMDocumentParserCallback::EndElement(const char* name) {
149152
if (strcmp(name, "osm") == 0) {
153+
m_rDocument.endOfFile();
150154
return;
151155
}
152156
if (strcmp(name, "node") == 0) {
@@ -169,7 +173,8 @@ void OSMDocumentParserCallback::EndElement(const char* name) {
169173
delete last_way;
170174
return;
171175

172-
} else if (strcmp(name, "relation") == 0) {
176+
}
177+
if (strcmp(name, "relation") == 0) {
173178
if (m_rDocument.config_has_tag(last_relation->tag_config())) {
174179
for (auto it = last_relation->way_refs().begin(); it != last_relation->way_refs().end(); ++it) {
175180
auto way_id = *it;
@@ -187,13 +192,10 @@ void OSMDocumentParserCallback::EndElement(const char* name) {
187192
}
188193
}
189194
}
195+
m_rDocument.AddRelation(*last_relation);
190196
}
191-
m_rDocument.AddRelation(*last_relation);
192197
delete last_relation;
193198

194-
} else if (strcmp(name, "osm") == 0) {
195-
m_rDocument.endOfFile();
196-
show_progress();
197199
}
198200
}
199201

src/utilities/handle_pgpass.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,9 @@ handle_pgpass(po::variables_map &vm) {
8585
&& (user == "*" || user == username)
8686
&& (dbase == "*" || host == vm["dbname"].as<std::string>())) {
8787
infile.close();
88+
#if 0
8889
std::cout << passwd << "\n";
90+
#endif
8991
vm.at("password").value() = passwd;
9092
return;
9193
}

0 commit comments

Comments
 (0)