only fail if not sort-in succeeded at all

This commit is contained in:
Patrick Brosi 2019-01-14 19:37:50 +01:00 committed by Patrick Brosi
parent 7835242cb8
commit 8fb21919f3

View file

@ -168,10 +168,11 @@ void OsmBuilder::read(const std::string& path, const OsmReadOpts& opts,
std::vector<const Stop*> notSnapped;
for (auto& s : *fs) {
bool snapped = false;
auto pl = plFromGtfs(s.first, opts);
for (size_t i = 0; i < opts.maxSnapDistances.size(); i++) {
double d = opts.maxSnapDistances[i];
for (auto& s : *fs) {
auto pl = plFromGtfs(s.first, opts);
StatGroup* group = groupStats(
snapStation(g, &pl, &eg, &sng, opts, res,
@ -180,7 +181,10 @@ void OsmBuilder::read(const std::string& path, const OsmReadOpts& opts,
if (group) {
group->addStop(s.first);
(*fs)[s.first] = *group->getNodes().begin();
} else if (i == opts.maxSnapDistances.size() - 1) {
snapped = true;
}
}
if (!snapped) {
LOG(VDEBUG) << "Could not snap station "
<< "(" << pl.getSI()->getName() << ")"
<< " (" << s.first->getLat() << "," << s.first->getLng()
@ -188,7 +192,6 @@ void OsmBuilder::read(const std::string& path, const OsmReadOpts& opts,
notSnapped.push_back(s.first);
}
}
}
if (notSnapped.size())
LOG(VDEBUG) << notSnapped.size() << " stations could not be snapped in "
@ -197,10 +200,11 @@ void OsmBuilder::read(const std::string& path, const OsmReadOpts& opts,
// try again, but aggressively snap to orphan OSM stations which have
// not been assigned to any GTFS stop yet
for (auto& s : notSnapped) {
bool snapped = false;
auto pl = plFromGtfs(s, opts);
for (size_t i = 0; i < opts.maxSnapDistances.size(); i++) {
double d = opts.maxSnapDistances[i];
for (auto& s : notSnapped) {
auto pl = plFromGtfs(s, opts);
StatGroup* group = groupStats(
snapStation(g, &pl, &eg, &sng, opts, res,
@ -215,8 +219,10 @@ void OsmBuilder::read(const std::string& path, const OsmReadOpts& opts,
n->pl().getSI()->addAltName(pl.getSI()->getName());
}
(*fs)[s] = *group->getNodes().begin();
} else if (i ==
opts.maxSnapDistances.size() - 1) { // only fail on last
snapped = true;
}
}
if (!snapped) {
// finally give up
// add a group with only this stop in it
@ -233,7 +239,6 @@ void OsmBuilder::read(const std::string& path, const OsmReadOpts& opts,
}
}
}
}
LOG(VDEBUG) << "Deleting orphan nodes...";
deleteOrphNds(g);
@ -299,7 +304,7 @@ void OsmBuilder::overpassQryWrite(std::ostream* out,
wr.writeText(" - written by pfaedle -");
wr.closeTag();
wr.openTag("osm-script",
{{"timeout", "99999"}, {"element-limit", "1073741824"}});
{{"timeout", "99999"}, {"element-limit", "2073741824"}});
OsmFilter filter;