diff --git a/src/overpass_api/data/tag_store.h b/src/overpass_api/data/tag_store.h index d1f565233..19ef49800 100644 --- a/src/overpass_api/data/tag_store.h +++ b/src/overpass_api/data/tag_store.h @@ -20,6 +20,7 @@ #define DE__OSM3S___OVERPASS_API__DATA__TAG_STORE_H +#include "abstract_processing.h" #include "filenames.h" #include "../core/datatypes.h" #include "../../template_db/block_backend.h" @@ -249,16 +250,19 @@ void collect_tags_framed uint32 coarse_index, Id_Type lower_id_bound, Id_Type upper_id_bound) { + const std::vector< Id_Type >& ids = ids_by_coarse[coarse_index]; + // Most of a cell's tag entries belong to other elements: reject those with one bit test. + Id_Bit_Filter id_filter(ids); while ((!(tag_it == items_db.range_end())) && (((tag_it.index().index) & 0x7fffff00) < coarse_index)) ++tag_it; while ((!(tag_it == items_db.range_end())) && (((tag_it.index().index) & 0x7fffff00) == coarse_index)) { - if (!(tag_it.object() < lower_id_bound) && + if (id_filter.maybe_contains(tag_it.object().val()) && + !(tag_it.object() < lower_id_bound) && (tag_it.object() < upper_id_bound) && - (binary_search(ids_by_coarse[coarse_index].begin(), - ids_by_coarse[coarse_index].end(), tag_it.object()))) + (binary_search(ids.begin(), ids.end(), tag_it.object()))) tags_by_id[tag_it.object()].push_back (std::make_pair(tag_it.index().key, tag_it.index().value)); ++tag_it;