dont output warning for unsnap if station lies outside the GTFS bounding box (because the trip it belongs to was filtered for some reason)

This commit is contained in:
Patrick Brosi 2019-01-15 19:10:10 +01:00 committed by Patrick Brosi
parent 8fb21919f3
commit 2fb157ef37
3 changed files with 22 additions and 9 deletions

View file

@ -189,6 +189,11 @@ void OsmBuilder::read(const std::string& path, const OsmReadOpts& opts,
<< "(" << pl.getSI()->getName() << ")"
<< " (" << s.first->getLat() << "," << s.first->getLng()
<< ") in normal run, trying again later in orphan mode.";
if (!bbox.contains(*pl.getGeom())) {
LOG(VDEBUG) << "Note: '" << pl.getSI()->getName()
<< "' does not lie within the bounds for this graph and "
"may be a stray station";
}
notSnapped.push_back(s.first);
}
}
@ -233,12 +238,22 @@ void OsmBuilder::read(const std::string& path, const OsmReadOpts& opts,
dummyGroup->addNode(dummyNode);
dummyGroup->addStop(s);
(*fs)[s] = dummyNode;
if (!bbox.contains(*pl.getGeom())) {
LOG(VDEBUG) << "Could not snap station "
<< "(" << pl.getSI()->getName() << ")"
<< " (" << s->getLat() << "," << s->getLng() << ")";
LOG(VDEBUG) << "Note: '" << pl.getSI()->getName()
<< "' does not lie within the bounds for this graph and "
"may be a stray station";
} else {
// only warn if it is contained in the BBOX for this graph
LOG(WARN) << "Could not snap station "
<< "(" << pl.getSI()->getName() << ")"
<< " (" << s->getLat() << "," << s->getLng() << ")";
}
}
}
}
LOG(VDEBUG) << "Deleting orphan nodes...";
deleteOrphNds(g);
@ -303,8 +318,7 @@ void OsmBuilder::overpassQryWrite(std::ostream* out,
wr.openComment();
wr.writeText(" - written by pfaedle -");
wr.closeTag();
wr.openTag("osm-script",
{{"timeout", "99999"}, {"element-limit", "2073741824"}});
wr.openTag("osm-script");
OsmFilter filter;

View file

@ -460,6 +460,7 @@ void ShapeBuilder::getGtfsBox(const Feed* feed, const MOTs& mots,
if (!tid.empty() && t.getId() != tid) continue;
if (tid.empty() && !t.getShape().empty() && !dropShapes) continue;
if (t.getStopTimes().size() < 2) continue;
if (mots.count(t.getRoute()->getType())) {
DBox cur;
for (const auto& st : t.getStopTimes()) {
@ -540,8 +541,6 @@ Clusters ShapeBuilder::clusterTrips(Feed* f, MOTs mots) {
std::map<StopPair, std::vector<size_t>> clusterIdx;
size_t j = 0;
Clusters ret;
for (auto& trip : f->getTrips()) {
if (!trip.getShape().empty() && !_cfg.dropShapes) continue;
@ -549,13 +548,13 @@ Clusters ShapeBuilder::clusterTrips(Feed* f, MOTs mots) {
if (!mots.count(trip.getRoute()->getType()) ||
!_motCfg.mots.count(trip.getRoute()->getType()))
continue;
bool found = false;
auto spair = StopPair(trip.getStopTimes().begin()->getStop(),
trip.getStopTimes().rbegin()->getStop());
const auto& c = clusterIdx[spair];
for (size_t i = 0; i < c.size(); i++) {
j++;
if (routingEqual(ret[c[i]][0], &trip)) {
ret[c[i]].push_back(&trip);
found = true;