From 2fb157ef373edc957e55405fa6bc8d18f087ef8f Mon Sep 17 00:00:00 2001 From: Patrick Brosi Date: Tue, 15 Jan 2019 19:10:10 +0100 Subject: [PATCH] dont output warning for unsnap if station lies outside the GTFS bounding box (because the trip it belongs to was filtered for some reason) --- src/pfaedle/osm/OsmBuilder.cpp | 24 +++++++++++++++++++----- src/pfaedle/router/ShapeBuilder.cpp | 5 ++--- src/pfaedle/router/ShapeBuilder.h | 2 +- 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/src/pfaedle/osm/OsmBuilder.cpp b/src/pfaedle/osm/OsmBuilder.cpp index bac40ee..e340c60 100644 --- a/src/pfaedle/osm/OsmBuilder.cpp +++ b/src/pfaedle/osm/OsmBuilder.cpp @@ -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,9 +238,19 @@ void OsmBuilder::read(const std::string& path, const OsmReadOpts& opts, dummyGroup->addNode(dummyNode); dummyGroup->addStop(s); (*fs)[s] = dummyNode; - LOG(WARN) << "Could not snap station " - << "(" << pl.getSI()->getName() << ")" - << " (" << s->getLat() << "," << s->getLng() << ")"; + 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() << ")"; + } } } } @@ -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; diff --git a/src/pfaedle/router/ShapeBuilder.cpp b/src/pfaedle/router/ShapeBuilder.cpp index 2beb663..988b7ad 100644 --- a/src/pfaedle/router/ShapeBuilder.cpp +++ b/src/pfaedle/router/ShapeBuilder.cpp @@ -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> 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; diff --git a/src/pfaedle/router/ShapeBuilder.h b/src/pfaedle/router/ShapeBuilder.h index 15c006e..3a88b93 100644 --- a/src/pfaedle/router/ShapeBuilder.h +++ b/src/pfaedle/router/ShapeBuilder.h @@ -105,7 +105,7 @@ class ShapeBuilder { std::string getFreeShapeId(Trip* t); ad::cppgtfs::gtfs::Shape getGtfsShape(const Shape& shp, Trip* t, - std::vector* hopDists); + std::vector* hopDists); void setShape(Trip* t, const ad::cppgtfs::gtfs::Shape& s, const std::vector& dists);