Merge pull request #220 from Gnonthgol/master

Parse mph properly on maxspeed tags
This commit is contained in:
Project OSRM 2012-04-13 04:28:37 -07:00
commit e1a8cad552

View File

@ -84,6 +84,14 @@ private:
} }
return matched; return matched;
} }
int parseMaxspeed(std::string input) {
int n = atoi(input.c_str());
if (input.find("mph") != input.npos) {
n = (n*1609)/1000;
}
return n;
}
public: public:
ExtractorCallbacks(STXXLContainers * ext, Settings set, StringMap * strMap) { ExtractorCallbacks(STXXLContainers * ext, Settings set, StringMap * strMap) {
@ -135,7 +143,7 @@ public:
std::string ref( w.keyVals.Find("ref")); std::string ref( w.keyVals.Find("ref"));
std::string junction( w.keyVals.Find("junction") ); std::string junction( w.keyVals.Find("junction") );
std::string route( w.keyVals.Find("route") ); std::string route( w.keyVals.Find("route") );
int maxspeed( atoi(w.keyVals.Find("maxspeed").c_str()) ); int maxspeed( parseMaxspeed(w.keyVals.Find("maxspeed")) );
std::string access( w.keyVals.Find("access") ); std::string access( w.keyVals.Find("access") );
std::string accessTag( w.keyVals.Find(settings.accessTag) ); std::string accessTag( w.keyVals.Find(settings.accessTag) );
std::string man_made( w.keyVals.Find("man_made") ); std::string man_made( w.keyVals.Find("man_made") );