Skip to content

Commit

Permalink
Remove backslashes from osm ways, as per:
Browse files Browse the repository at this point in the history
Some of the road/way names in the OSM data seem to contain a backslash ("\") which
they should not. This case is not tested and fixed by the "osm2pgrouting" tool so far
and this most probably causes the error you get. What you could do is inserting the
following line in the in the "exportWays" method in the "Export2DB.cpp" file (in the
"src" folder of your "osm2pgrouting" folder) and after that build the tool again
("make"):

http://gis.stackexchange.com/questions/12070/error-during-importing-a-map-with-osm2pgrouting
  • Loading branch information
peteryates committed Jul 4, 2012
1 parent fda9179 commit a120fc2
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/Export2DB.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,12 @@ void Export2DB::exportWays(std::vector<Way*>& ways, Configuration* config)
row_data += "\t";
if(!way->name.empty())
{
std::string escaped_name = way->name;
boost::replace_all(escaped_name, "\t", "\\\t");
boost::replace_all(escaped_name, "\n", "");
boost::replace_all(escaped_name, "\r", "");
row_data += escaped_name.substr(0,199);
std::string escaped_name = way->name;
boost::replace_all(escaped_name, "\t", "\\\t");
boost::replace_all(escaped_name, "\n", "");
boost::replace_all(escaped_name, "\r", "");
boost::replace_all(escaped_name, "\\", "");
row_data += escaped_name.substr(0,199);
}
row_data += "\n";
PQputline(mycon, row_data.c_str());
Expand Down

0 comments on commit a120fc2

Please sign in to comment.