add --osmfilter option
This commit is contained in:
parent
6473dcdb52
commit
c25d174e60
14 changed files with 185 additions and 30 deletions
|
|
@ -183,6 +183,50 @@ void OsmBuilder::read(const std::string& path, const OsmReadOpts& opts,
|
|||
LOG(DEBUG) << _lines.size() << " transit lines have been read.";
|
||||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
void OsmBuilder::osmfilterRuleWrite(std::ostream* out,
|
||||
const std::vector<OsmReadOpts>& opts,
|
||||
const BBoxIdx& latLngBox) const {
|
||||
UNUSED(latLngBox);
|
||||
OsmIdSet bboxNodes, noHupNodes;
|
||||
MultAttrMap emptyF;
|
||||
|
||||
RelLst rels;
|
||||
OsmIdList ways;
|
||||
RelMap nodeRels, wayRels;
|
||||
|
||||
NIdMap nodes;
|
||||
|
||||
OsmFilter filter;
|
||||
|
||||
AttrKeySet attrKeys[3] = {};
|
||||
|
||||
for (const OsmReadOpts& o : opts) {
|
||||
filter = filter.merge(OsmFilter(o.keepFilter, o.dropFilter));
|
||||
getKeptAttrKeys(o, attrKeys);
|
||||
}
|
||||
|
||||
*out << "--keep=\n";
|
||||
|
||||
for (auto r : filter.getKeepRules()) {
|
||||
for (auto val : r.second) {
|
||||
*out << r.first << "=";
|
||||
if (val.first != "*") *out << val.first;
|
||||
*out << "\n";
|
||||
}
|
||||
}
|
||||
|
||||
*out << "\n";
|
||||
|
||||
*out << "--keep-tags=\n";
|
||||
|
||||
for (const auto& keys : attrKeys) {
|
||||
for (auto val : keys) {
|
||||
*out << val << "=\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// _____________________________________________________________________________
|
||||
void OsmBuilder::overpassQryWrite(std::ostream* out,
|
||||
const std::vector<OsmReadOpts>& opts,
|
||||
|
|
|
|||
|
|
@ -92,6 +92,12 @@ class OsmBuilder {
|
|||
void overpassQryWrite(std::ostream* out, const std::vector<OsmReadOpts>& opts,
|
||||
const BBoxIdx& latLngBox) const;
|
||||
|
||||
// Based on the list of options, output an osmfilter configuration file
|
||||
// to filter the data needed for routing
|
||||
void osmfilterRuleWrite(std::ostream* out,
|
||||
const std::vector<OsmReadOpts>& opts,
|
||||
const BBoxIdx& latLngBox) const;
|
||||
|
||||
// Based on the list of options, read an OSM file from in and output an
|
||||
// OSM file to out which contains exactly the entities that are needed
|
||||
// from the file at in
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue