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() << ")" << "(" << pl.getSI()->getName() << ")"
<< " (" << s.first->getLat() << "," << s.first->getLng() << " (" << s.first->getLat() << "," << s.first->getLng()
<< ") in normal run, trying again later in orphan mode."; << ") 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); notSnapped.push_back(s.first);
} }
} }
@ -233,9 +238,19 @@ void OsmBuilder::read(const std::string& path, const OsmReadOpts& opts,
dummyGroup->addNode(dummyNode); dummyGroup->addNode(dummyNode);
dummyGroup->addStop(s); dummyGroup->addStop(s);
(*fs)[s] = dummyNode; (*fs)[s] = dummyNode;
LOG(WARN) << "Could not snap station " if (!bbox.contains(*pl.getGeom())) {
<< "(" << pl.getSI()->getName() << ")" LOG(VDEBUG) << "Could not snap station "
<< " (" << s->getLat() << "," << s->getLng() << ")"; << "(" << 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() << ")";
}
} }
} }
} }
@ -303,8 +318,7 @@ void OsmBuilder::overpassQryWrite(std::ostream* out,
wr.openComment(); wr.openComment();
wr.writeText(" - written by pfaedle -"); wr.writeText(" - written by pfaedle -");
wr.closeTag(); wr.closeTag();
wr.openTag("osm-script", wr.openTag("osm-script");
{{"timeout", "99999"}, {"element-limit", "2073741824"}});
OsmFilter filter; 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.getId() != tid) continue;
if (tid.empty() && !t.getShape().empty() && !dropShapes) continue; if (tid.empty() && !t.getShape().empty() && !dropShapes) continue;
if (t.getStopTimes().size() < 2) continue; if (t.getStopTimes().size() < 2) continue;
if (mots.count(t.getRoute()->getType())) { if (mots.count(t.getRoute()->getType())) {
DBox cur; DBox cur;
for (const auto& st : t.getStopTimes()) { 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; std::map<StopPair, std::vector<size_t>> clusterIdx;
size_t j = 0;
Clusters ret; Clusters ret;
for (auto& trip : f->getTrips()) { for (auto& trip : f->getTrips()) {
if (!trip.getShape().empty() && !_cfg.dropShapes) continue; if (!trip.getShape().empty() && !_cfg.dropShapes) continue;
@ -549,13 +548,13 @@ Clusters ShapeBuilder::clusterTrips(Feed* f, MOTs mots) {
if (!mots.count(trip.getRoute()->getType()) || if (!mots.count(trip.getRoute()->getType()) ||
!_motCfg.mots.count(trip.getRoute()->getType())) !_motCfg.mots.count(trip.getRoute()->getType()))
continue; continue;
bool found = false; bool found = false;
auto spair = StopPair(trip.getStopTimes().begin()->getStop(), auto spair = StopPair(trip.getStopTimes().begin()->getStop(),
trip.getStopTimes().rbegin()->getStop()); trip.getStopTimes().rbegin()->getStop());
const auto& c = clusterIdx[spair]; const auto& c = clusterIdx[spair];
for (size_t i = 0; i < c.size(); i++) { for (size_t i = 0; i < c.size(); i++) {
j++;
if (routingEqual(ret[c[i]][0], &trip)) { if (routingEqual(ret[c[i]][0], &trip)) {
ret[c[i]].push_back(&trip); ret[c[i]].push_back(&trip);
found = true; found = true;

View file

@ -105,7 +105,7 @@ class ShapeBuilder {
std::string getFreeShapeId(Trip* t); std::string getFreeShapeId(Trip* t);
ad::cppgtfs::gtfs::Shape getGtfsShape(const Shape& shp, Trip* t, ad::cppgtfs::gtfs::Shape getGtfsShape(const Shape& shp, Trip* t,
std::vector<double>* hopDists); std::vector<double>* hopDists);
void setShape(Trip* t, const ad::cppgtfs::gtfs::Shape& s, void setShape(Trip* t, const ad::cppgtfs::gtfs::Shape& s,
const std::vector<double>& dists); const std::vector<double>& dists);